diff --git a/.github/workflows/tag-and-build.yml b/.github/workflows/tag-and-build.yml index 339d5b6f..bd2002a0 100644 --- a/.github/workflows/tag-and-build.yml +++ b/.github/workflows/tag-and-build.yml @@ -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 @@ -132,6 +134,28 @@ 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 }}" + PR_NUMBER=$(gh pr view ${{ env.PR_BRANCH_NAME }} --json number --jq .number) + gh pr comment $PR_NUMBER --body "/lgtm" + gh pr comment $PR_NUMBER --body "/approve" + 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: |