Skip to content

Commit

Permalink
Release workflow - open a PR with changes instead of direct push
Browse files Browse the repository at this point in the history
  • Loading branch information
sutaakar authored and openshift-merge-robot committed Jul 28, 2023
1 parent ef43fee commit 817f97e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/tag-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ jobs:
# Permission required to create a release
permissions:
contents: write
pull-requests: write

env:
IMAGE_ORG_BASE: quay.io/${{ github.event.inputs.quay-organization }}
PR_BRANCH_NAME: adjustments-release-${{ github.event.inputs.version }}

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -132,6 +134,25 @@ jobs:
with:
commit_message: Update dependency versions for release ${{ github.event.inputs.version }}
file_pattern: 'README.md controllers/defaults.go *.yaml Makefile go.mod go.sum'
create_branch: true
branch: ${{ env.PR_BRANCH_NAME }}

- name: Create a PR with code changes
run: |
GIT_BRANCH=${GITHUB_REF#refs/heads/}
gh pr create --base "$GIT_BRANCH" --fill --head "${{ env.PR_BRANCH_NAME }}" --label "lgtm" --label "approved"
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}

- name: Wait until PR with code changes is merged
run: |
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'
env:
GITHUB_TOKEN: ${{ github.TOKEN }}

- name: Delete remote branch
run: |
git push origin --delete ${{ env.PR_BRANCH_NAME }}
- name: Creates a release in GitHub
run: |
Expand Down

0 comments on commit 817f97e

Please sign in to comment.