File tree 1 file changed +48
-0
lines changed
1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Close stale issues
2
+
3
+ on :
4
+ schedule :
5
+ - cron : " 0 0 * * *"
6
+ workflow_dispatch :
7
+
8
+ env :
9
+ GH_TOKEN : ${{ github.token }}
10
+
11
+ jobs :
12
+ check_stale_issues :
13
+ runs-on : ubuntu-latest
14
+
15
+ steps :
16
+ - name : Checkout repository
17
+ uses : actions/checkout@v4
18
+ - name : Gather labels
19
+ run : |
20
+ awaiting_labels=$(
21
+ gh label list --json name --jq '.[] | \
22
+ select(.name | test("^S-awaiting")) | \
23
+ .name'
24
+ )
25
+ echo "Found relevant labels: $awaiting_labels"
26
+ echo "awaiting_labels=$awaiting_labels" >> $GITHUB_ENV
27
+ - name : Gather pull requests
28
+ id : get_issues
29
+ run : |
30
+ date=$(date --date='10 days ago' --utc +%Y-%m-%dT%H:%M:%SZ)
31
+ prs=""
32
+ for label in $awaiting_labels; do
33
+ pr_numbers=$(
34
+ gh pr list --label "$label" --json "number,updatedAt" --jq '.[] | \
35
+ select(.updatedAt < "$date") | .number')
36
+ prs="$prs $pr_numbers"
37
+ done
38
+ echo "prs=$prs" >> $GITHUB_ENV
39
+ - name : Close pull requests
40
+ if : env.prs != ''
41
+ run : |
42
+ for number in $prs; do
43
+ gh issue comment $number --body "This PR has been awaiting action for \
44
+ more than 10 days with no response. Because of this inactivity, the PR \
45
+ is being closed. If you continue working on the PR, please comment here \
46
+ when it is ready for re-review."
47
+ gh issue close $number
48
+ done
You can’t perform that action at this time.
0 commit comments