File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 env :
2121 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2222 PR_TITLE : ${{ github.event.pull_request.title }}
23+ PR_NUMBER : ${{ github.event.pull_request.number }}
2324 REPO : ${{ github.repository }}
2425 run : |
2526 # Backport PR titles follow the pattern: [9.2] Original title (#1234)
2930 exit 0
3031 fi
3132 echo "Original PR: #$ORIGINAL_PR"
33+ echo "Just-merged backport PR: #$PR_NUMBER"
3234
3335 HAS_LABEL=$(gh pr view "$ORIGINAL_PR" --repo "$REPO" --json labels \
3436 --jq '[.labels[].name] | if index("backport-pending") then "true" else "false" end')
3739 exit 0
3840 fi
3941
42+ # Count open backport PRs, excluding the just-merged PR (API eventual consistency).
4043 OPEN_BACKPORTS=$(gh pr list --repo "$REPO" --label backport --state open \
4144 --json number,title \
42- --jq "[.[] | select(.title | test(\"\\\\(#${ORIGINAL_PR}\\\\)\"))] | length")
45+ --jq "[.[] | select(.number != ${PR_NUMBER}) | select(. title | test(\"\\\\(#${ORIGINAL_PR}\\\\)\"))] | length")
4346 echo "Open backport PRs remaining: $OPEN_BACKPORTS"
4447
4548 if [ "$OPEN_BACKPORTS" -eq 0 ]; then
You can’t perform that action at this time.
0 commit comments