File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Close release-* PRs
2+
3+ on :
4+ # Manual
5+ workflow_dispatch :
6+ schedule :
7+ # Run daily at 2am UTC
8+ - cron : " 0 2 * * *"
9+
10+ permissions :
11+ pull-requests : write
12+ contents : read
13+
14+ jobs :
15+ close-release-prs :
16+ runs-on : ubuntu-latest
17+
18+ steps :
19+ - name : Close PRs for release-* branches
20+ env :
21+ GH_TOKEN : ${{ secrets.GH_TOKEN }}
22+ run : |
23+ echo "Finding open PRs that are for release branches"
24+
25+ prs=$(gh pr list \
26+ --state open \
27+ --json number,headRefName \
28+ --jq '.[] | select(.headRefName | contains("release-")) | .number')
29+
30+ if [ -z "$prs" ]; then
31+ echo "No matching PRs found."
32+ exit 0
33+ fi
34+
35+ for pr in $prs; do
36+ echo "Closing PR #$pr"
37+ gh pr close "$pr" --comment "Automatically closing pull request for release branch."
38+ done
39+
You can’t perform that action at this time.
0 commit comments