|
1 | 1 | # Generated for Konflux Application openshift-pipelines-core by openshift-pipelines/hack. DO NOT EDIT |
2 | | -name: auto-merge-upstream-tektoncd-git-clone |
| 2 | +name: auto-merge-upstream |
3 | 3 |
|
4 | 4 | on: |
5 | 5 | workflow_dispatch: {} |
6 | | - schedule: |
7 | | - - cron: "*/30 * * * *" # At every 30 minutes |
8 | 6 |
|
9 | 7 | jobs: |
10 | | - auto-approve: |
| 8 | + auto-approve-and-merge: |
11 | 9 | runs-on: ubuntu-latest |
12 | 10 | permissions: |
13 | 11 | pull-requests: write |
14 | 12 | steps: |
15 | 13 | - name: Checkout the current repo |
16 | | - uses: actions/checkout@v4 |
17 | | - - name: auto-merge-upstream-tektoncd-git-clone |
| 14 | + uses: actions/checkout@v5 |
| 15 | + - id: list-prs |
18 | 16 | run: | |
| 17 | + echo "Listing PRs" |
19 | 18 | gh auth status |
20 | 19 | git config user.name openshift-pipelines-bot |
21 | 20 | git config user.email [email protected] |
22 | 21 | # Approve and merge pull-request with no reviews |
23 | | - for p in $(gh pr list --search "head:actions/update/sources-tektoncd-git-clone" --json "number" | jq ".[].number"); do |
| 22 | +
|
| 23 | + pr_list=$(gh pr list \ |
| 24 | + --state open \ |
| 25 | + --label upstream \ |
| 26 | + --json number,title,statusCheckRollup \ |
| 27 | + --jq ' .[]| select((.statusCheckRollup // [])| all(.conclusion == "SUCCESS" or .conclusion == "SKIPPED"))| "\(.number)"') |
| 28 | + |
| 29 | + echo "pr_list=$pr_list" >> "$GITHUB_OUTPUT" |
| 30 | + env: |
| 31 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + |
| 33 | + - id: add LGTM Label |
| 34 | + run: | |
| 35 | + # Approve and merge pull-request with no reviews |
| 36 | + for p in $pr_list; do |
| 37 | + echo "Adding lgtm label to PR $p" |
| 38 | + gh pr edit $p --add-label "lgtm" || true |
| 39 | + done |
| 40 | + env: |
| 41 | + pr_list: ${{ steps.list-prs.outputs.pr_list }} |
| 42 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + - id: Merging PRs |
| 44 | + run: | |
| 45 | + # Approve and merge pull-request with no reviews |
| 46 | + for p in $pr_list; do |
| 47 | + echo "Merging PR $p" |
24 | 48 | gh pr merge --rebase --delete-branch --auto $p |
25 | 49 | done |
26 | 50 | env: |
| 51 | + pr_list: ${{ steps.list-prs.outputs.pr_list }} |
27 | 52 | GH_TOKEN: ${{ secrets.OPENSHIFT_PIPELINES_ROBOT }} |
28 | | - |
|
0 commit comments