This repository was archived by the owner on Sep 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
40 lines (34 loc) · 1.33 KB
/
stale.yml
File metadata and controls
40 lines (34 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Close stale issues
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
env:
GH_TOKEN: ${{ github.token }}
jobs:
check_stale_issues:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Close PRs
run: |
awaiting_labels=$(gh label list --json name --jq '.[] | select(.name | test("^S-awaiting")) | .name')
date=$(date --date='10 days ago' --utc +%Y-%m-%dT%H:%M:%SZ)
prs=""
for label in $awaiting_labels; do
pr_numbers=$(
gh api /repos/${{ github.repository }}/pulls --jq '.[] | select ((.labels | any(.name == "'$label'")) and .head.repo.pushed_at < "'$date'") | .number')
prs="$prs $pr_numbers"
done
for number in $prs; do
# Check if the PR is still open
if [ $(gh api /repos/${{ github.repository }}/pulls/$number --jq '.state') != "open" ]; then
continue
fi
gh issue comment $number --body "This PR has been awaiting action for \
more than 10 days with no response. Because of this inactivity, the PR \
is being closed. If you continue working on the PR, please comment here \
when it is ready for re-review."
gh issue close $number
done