Skip to content

Commit 817f97e

Browse files
sutaakaropenshift-merge-robot
authored andcommitted
Release workflow - open a PR with changes instead of direct push
1 parent ef43fee commit 817f97e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/tag-and-build.yml

+21
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ jobs:
4848
# Permission required to create a release
4949
permissions:
5050
contents: write
51+
pull-requests: write
5152

5253
env:
5354
IMAGE_ORG_BASE: quay.io/${{ github.event.inputs.quay-organization }}
55+
PR_BRANCH_NAME: adjustments-release-${{ github.event.inputs.version }}
5456

5557
steps:
5658
- uses: actions/checkout@v3
@@ -132,6 +134,25 @@ jobs:
132134
with:
133135
commit_message: Update dependency versions for release ${{ github.event.inputs.version }}
134136
file_pattern: 'README.md controllers/defaults.go *.yaml Makefile go.mod go.sum'
137+
create_branch: true
138+
branch: ${{ env.PR_BRANCH_NAME }}
139+
140+
- name: Create a PR with code changes
141+
run: |
142+
GIT_BRANCH=${GITHUB_REF#refs/heads/}
143+
gh pr create --base "$GIT_BRANCH" --fill --head "${{ env.PR_BRANCH_NAME }}" --label "lgtm" --label "approved"
144+
env:
145+
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
146+
147+
- name: Wait until PR with code changes is merged
148+
run: |
149+
timeout 3600 bash -c 'until [[ $(gh pr view '${{ env.PR_BRANCH_NAME }}' --json state --jq .state) == "MERGED" ]]; do sleep 5 && echo "$(gh pr view '${{ env.PR_BRANCH_NAME }}' --json state --jq .state)"; done'
150+
env:
151+
GITHUB_TOKEN: ${{ github.TOKEN }}
152+
153+
- name: Delete remote branch
154+
run: |
155+
git push origin --delete ${{ env.PR_BRANCH_NAME }}
135156
136157
- name: Creates a release in GitHub
137158
run: |

0 commit comments

Comments
 (0)