auto-merge-upstream #2979
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: | |
| 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 [email protected] | |
| # Approve and merge pull-request with no reviews | |
| pr_list=$(gh pr list \ | |
| --state open \ | |
| --label upstream \ | |
| --json number,title,statusCheckRollup \ | |
| --jq ' .[]| select((.statusCheckRollup // [])| all(.conclusion == "SUCCESS" or .conclusion == "SKIPPED"))| "\(.number)"') | |
| echo "pr_list=$pr_list" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: 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" || 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 $pr_list; do | |
| echo "Merging PR $p" | |
| gh pr merge --rebase --delete-branch --auto $p | |
| done | |
| env: | |
| pr_list: ${{ steps.list-prs.outputs.pr_list }} | |
| GH_TOKEN: ${{ secrets.OPENSHIFT_PIPELINES_ROBOT }} |