Skip to content

Commit

Permalink
ci: make the PR from a feature branch to avoid force pushing main branch
Browse files Browse the repository at this point in the history
Signed-off-by: Harikrishnan Balagopal <harikrishmenon@gmail.com>
  • Loading branch information
HarikrishnanBalagopal committed Sep 24, 2023
1 parent 56c21a5 commit 75d1d11
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/raise-operator-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ jobs:
VERSION_WITHOUT_V="${VERSION#v}"
cp -r /tmp/bundle-operator-move2kube "${VERSION_WITHOUT_V}" && cp /tmp/bundle.Dockerfile "${VERSION_WITHOUT_V}"/bundle.Dockerfile
echo 'make a commit and push to our fork'
# https://stackoverflow.com/questions/67789507/generate-unique-string-in-github-actions
BRANCH_NAME='feat-${{ github.event.inputs.tag }}-${{ github.run_id }}-${{ github.run_attempt }}'
git checkout -b "${BRANCH_NAME}"
git add -A
git commit -s -m 'operator move2kube-operator (${{ github.event.inputs.tag }})'
git push -u origin main
git push -u origin "${BRANCH_NAME}"
- name: create-pull-request-to-community-repo
run: |
curl -L \
Expand All @@ -64,7 +67,7 @@ jobs:
-H 'Authorization: Bearer ${{ secrets.MOVE2KUBE_PATOKEN }}' \
-H 'X-GitHub-Api-Version: 2022-11-28' \
https://api.github.com/repos/k8s-operatorhub/community-operators/pulls \
-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"}'
-d '{"title":"operator move2kube-operator (${{ github.event.inputs.tag }})","body":"An automated PR to update move2kube-operator to ${{ github.event.inputs.tag }}","head":"move2kube:'"${BRANCH_NAME}"'","base":"main"}'
- name: checkout-the-move2kube-fork-of-the-prod-upstream-repo
shell: bash
run: |
Expand All @@ -83,9 +86,12 @@ jobs:
VERSION_WITHOUT_V="${VERSION#v}"
cp -r /tmp/bundle-operator-move2kube "${VERSION_WITHOUT_V}" && cp /tmp/bundle.Dockerfile "${VERSION_WITHOUT_V}"/bundle.Dockerfile
echo 'make a commit and push to our fork'
# https://stackoverflow.com/questions/67789507/generate-unique-string-in-github-actions
BRANCH_NAME='feat-${{ github.event.inputs.tag }}-${{ github.run_id }}-${{ github.run_attempt }}'
git checkout -b "${BRANCH_NAME}"
git add -A
git commit -s -m 'operator move2kube-operator (${{ github.event.inputs.tag }})'
git push -u origin main
git push -u origin "${BRANCH_NAME}"
- name: create-pull-request-to-prod-repo
run: |
curl -L \
Expand All @@ -94,4 +100,4 @@ jobs:
-H 'Authorization: Bearer ${{ secrets.MOVE2KUBE_PATOKEN }}' \
-H 'X-GitHub-Api-Version: 2022-11-28' \
https://api.github.com/repos/redhat-openshift-ecosystem/community-operators-prod/pulls \
-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"}'
-d '{"title":"operator move2kube-operator (${{ github.event.inputs.tag }})","body":"An automated PR to update move2kube-operator to ${{ github.event.inputs.tag }}","head":"move2kube:'"${BRANCH_NAME}"'","base":"main"}'

0 comments on commit 75d1d11

Please sign in to comment.