66
77jobs :
88 auto-approve-and-merge :
9+ # This line prevents the job from running if CodeFreeze is true
10+ if : false
911 runs-on : ubuntu-latest
1012 permissions :
1113 pull-requests : write
@@ -19,35 +21,43 @@ jobs:
1921 gh auth status
2022 git config user.name openshift-pipelines-bot
2123 git config user.email pipelines-extcomm@redhat.com
22- # Approve and merge pull-request with no reviews
2324
2425 pr_list=$(gh pr list \
2526 --state open \
27+ --base release-v1.22.x \
28+ --search 'label:upstream -label:do-not-merge/hold' \
29+ --json number \
30+ --jq '.[]|.number')
31+
32+ success_pr_list=$(gh pr list \
33+ --state open \
34+ --base release-v1.22.x \
2635 --search 'label:upstream -label:do-not-merge/hold' \
2736 --json number,title,statusCheckRollup \
2837 --jq ' .[]| select((.statusCheckRollup // [])| all(.conclusion == "SUCCESS" or .conclusion == "SKIPPED"))| "\(.number)"')
2938
3039 echo "pr_list=$pr_list" >> "$GITHUB_OUTPUT"
40+ echo "success_pr_list=$success_pr_list" >> "$GITHUB_OUTPUT"
3141 env :
3242 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3343
34- - name : add LGTM Label
44+ - name : Approve and add LGTM Label
3545 run : |
3646 # Approve and merge pull-request with no reviews
3747 for p in $pr_list; do
3848 echo "Adding lgtm label to PR $p"
39- gh pr edit $p --add-label "lgtm" || true
49+ gh pr edit $p --add-label "lgtm" --add-label "approved" || true
4050 done
4151 env :
4252 pr_list : ${{ steps.list-prs.outputs.pr_list }}
4353 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4454 - name : Merging PRs
4555 run : |
4656 # Approve and merge pull-request with no reviews
47- for p in $pr_list ; do
57+ for p in $success_pr_list ; do
4858 echo "Merging PR $p"
4959 gh pr merge --rebase --delete-branch --auto $p
5060 done
5161 env :
52- pr_list : ${{ steps.list-prs.outputs.pr_list }}
62+ success_pr_list : ${{ steps.list-prs.outputs.success_pr_list }}
5363 GH_TOKEN : ${{ secrets.OPENSHIFT_PIPELINES_ROBOT }}
0 commit comments