Skip to content

Commit d128f98

Browse files
ci: sync our fork with the upstream repo before making a commit (#76)
* ci: sync our fork with the upstream repo before making a commit Signed-off-by: Harikrishnan Balagopal <[email protected]> * ci: raise a pr to the OperatorHub community and prod repos Signed-off-by: Harikrishnan Balagopal <[email protected]> --------- Signed-off-by: Harikrishnan Balagopal <[email protected]>
1 parent 0970821 commit d128f98

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

.github/workflows/raise-pr.yml

+28-8
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,28 @@ jobs:
3636
git checkout main
3737
git config user.name move2kube
3838
git config user.email [email protected]
39+
echo 'sync our fork with upstream'
40+
git remote add upstream https://github.com/k8s-operatorhub/community-operators
41+
git fetch --all
42+
git rebase upstream/main
3943
echo 'copy-bundle-into-fork-creating-new-version-dir'
4044
cd operators/move2kube-operator/ || exit 1
4145
VERSION='${{ github.event.inputs.tag }}'
4246
VERSION_WITHOUT_V="${VERSION#v}"
4347
cp -r /tmp/bundle-operator-move2kube "${VERSION_WITHOUT_V}" && cp /tmp/bundle.Dockerfile "${VERSION_WITHOUT_V}"/bundle.Dockerfile
44-
echo 'make a commit'
48+
echo 'make a commit and push to our fork'
4549
git add -A
4650
git commit -s -m 'operator move2kube-operator (${{ github.event.inputs.tag }})'
4751
git push -u origin main
48-
# - name: create-pull-request
49-
# run: |
50-
# curl "https://api.github.com/repos/k8s-operatorhub/community-operators/pulls" --user "${GITHUB_USER}:${GITHUB_TOKEN}" -X POST --data '{"title": "'"$(git log -1 --format=%s)"'", "base": "main", "body": "An automated PR to update konveyor-operator to v'"${OPERATOR_VERSION}"'", "head": "'"${GITHUB_USER}:${OPERATOR_VERSION}"'"}'
52+
- name: create-pull-request-to-community-repo
53+
run: |
54+
curl -L \
55+
-X POST \
56+
-H 'Accept: application/vnd.github+json' \
57+
-H 'Authorization: Bearer ${{ secrets.MOVE2KUBE_PATOKEN }}' \
58+
-H 'X-GitHub-Api-Version: 2022-11-28' \
59+
https://api.github.com/repos/k8s-operatorhub/community-operators/pulls \
60+
-d '{"title":"operator move2kube-operator (${{ github.event.inputs.tag }})","body":"An automated PR to update move2kube-operator to ${{ github.event.inputs.tag }}","head":"move2kube:main","base":"main"}'
5161
- name: checkout-the-move2kube-fork-of-the-prod-upstream-repo
5262
shell: bash
5363
run: |
@@ -56,15 +66,25 @@ jobs:
5666
git checkout main
5767
git config user.name move2kube
5868
git config user.email [email protected]
69+
echo 'sync our fork with upstream'
70+
git remote add upstream https://github.com/redhat-openshift-ecosystem/community-operators-prod
71+
git fetch --all
72+
git rebase upstream/main
5973
echo 'copy-bundle-into-fork-of-prod-repo-creating-new-version-dir'
6074
cd operators/move2kube-operator/ || exit 1
6175
VERSION='${{ github.event.inputs.tag }}'
6276
VERSION_WITHOUT_V="${VERSION#v}"
6377
cp -r /tmp/bundle-operator-move2kube "${VERSION_WITHOUT_V}" && cp /tmp/bundle.Dockerfile "${VERSION_WITHOUT_V}"/bundle.Dockerfile
64-
echo 'make a commit'
78+
echo 'make a commit and push to our fork'
6579
git add -A
6680
git commit -s -m 'operator move2kube-operator (${{ github.event.inputs.tag }})'
6781
git push -u origin main
68-
# - name: create-pull-request
69-
# run: |
70-
# curl "https://api.github.com/repos/k8s-operatorhub/community-operators/pulls" --user "${GITHUB_USER}:${GITHUB_TOKEN}" -X POST --data '{"title": "'"$(git log -1 --format=%s)"'", "base": "main", "body": "An automated PR to update konveyor-operator to v'"${OPERATOR_VERSION}"'", "head": "'"${GITHUB_USER}:${OPERATOR_VERSION}"'"}'
82+
- name: create-pull-request-to-prod-repo
83+
run: |
84+
curl -L \
85+
-X POST \
86+
-H 'Accept: application/vnd.github+json' \
87+
-H 'Authorization: Bearer ${{ secrets.MOVE2KUBE_PATOKEN }}' \
88+
-H 'X-GitHub-Api-Version: 2022-11-28' \
89+
https://api.github.com/repos/redhat-openshift-ecosystem/community-operators-prod/pulls \
90+
-d '{"title":"operator move2kube-operator (${{ github.event.inputs.tag }})","body":"An automated PR to update move2kube-operator to ${{ github.event.inputs.tag }}","head":"move2kube:main","base":"main"}'

0 commit comments

Comments
 (0)