auto-merge-upstream #5399
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Generated for Konflux Application openshift-pipelines-core by openshift-pipelines/hack. DO NOT EDIT | |
| name: auto-merge-upstream | |
| on: | |
| workflow_dispatch: {} | |
| jobs: | |
| auto-approve-and-merge: | |
| # This line prevents the job from running if CodeFreeze is true | |
| if: false | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: Checkout the current repo | |
| uses: actions/checkout@v5 | |
| - name: List PRs | |
| id: list-prs | |
| run: | | |
| echo "Listing PRs" | |
| gh auth status | |
| git config user.name openshift-pipelines-bot | |
| git config user.email pipelines-extcomm@redhat.com | |
| pr_list=$(gh pr list \ | |
| --state open \ | |
| --base release-v1.22.x \ | |
| --search 'label:upstream -label:do-not-merge/hold' \ | |
| --json number \ | |
| --jq '.[]|.number') | |
| success_pr_list=$(gh pr list \ | |
| --state open \ | |
| --base release-v1.22.x \ | |
| --search 'label:upstream -label:do-not-merge/hold' \ | |
| --json number,title,statusCheckRollup \ | |
| --jq ' .[]| select((.statusCheckRollup // [])| all(.conclusion == "SUCCESS" or .conclusion == "SKIPPED"))| "\(.number)"') | |
| echo "pr_list=$pr_list" >> "$GITHUB_OUTPUT" | |
| echo "success_pr_list=$success_pr_list" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Approve and add LGTM Label | |
| run: | | |
| # Approve and merge pull-request with no reviews | |
| for p in $pr_list; do | |
| echo "Adding lgtm label to PR $p" | |
| gh pr edit $p --add-label "lgtm" --add-label "approved" || true | |
| done | |
| env: | |
| pr_list: ${{ steps.list-prs.outputs.pr_list }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Merging PRs | |
| run: | | |
| # Approve and merge pull-request with no reviews | |
| for p in $success_pr_list; do | |
| echo "Merging PR $p" | |
| gh pr merge --rebase --delete-branch --auto $p | |
| done | |
| env: | |
| success_pr_list: ${{ steps.list-prs.outputs.success_pr_list }} | |
| GH_TOKEN: ${{ secrets.OPENSHIFT_PIPELINES_ROBOT }} |