-
-
Notifications
You must be signed in to change notification settings - Fork 5
80 lines (68 loc) · 2.71 KB
/
Copy pathissue-daily.yml
File metadata and controls
80 lines (68 loc) · 2.71 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: issue-daily
on:
schedule:
- cron: 0 0 * * *
jobs:
issue-label-stale:
name: label stale issues
runs-on: ubuntu-latest
steps:
- name: Label inactive issues as stale
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
set -euo pipefail
cutoff="$(date -u -d '15 days ago' '+%Y-%m-%d')"
query="repo:${GH_REPO} is:issue is:open updated:<${cutoff}"
excluded_labels=(
"bug"
"documentation"
"enhancement"
"feature"
"help wanted"
"need reproduction"
"need review"
"stale"
)
for label in "${excluded_labels[@]}"; do
query="${query} -label:\"${label}\""
done
printf 'This issue is marked as `stale` because it has not had recent activity. Issues marked with `stale` will be closed if they have no activity within 7 days.\n' > "${RUNNER_TEMP}/stale-comment.md"
gh api --method GET --paginate /search/issues -f q="${query}" -f per_page=100 --jq '.items[].number' |
while read -r issue_number; do
gh issue edit "${issue_number}" --repo "${GH_REPO}" --add-label "stale"
gh issue comment "${issue_number}" --repo "${GH_REPO}" --body-file "${RUNNER_TEMP}/stale-comment.md"
done
issue-close-stale:
name: close stale issues
runs-on: ubuntu-latest
steps:
- name: Close inactive stale issues
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
set -euo pipefail
cutoff="$(date -u -d '7 days ago' '+%Y-%m-%d')"
query="repo:${GH_REPO} is:issue is:open label:\"stale\" updated:<${cutoff}"
gh api --method GET --paginate /search/issues -f q="${query}" -f per_page=100 --jq '.items[].number' |
while read -r issue_number; do
gh issue close "${issue_number}" --repo "${GH_REPO}"
done
issue-close-need-reproduction:
name: close need-reproduction issues
runs-on: ubuntu-latest
steps:
- name: Close inactive need-reproduction issues
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
set -euo pipefail
cutoff="$(date -u -d '7 days ago' '+%Y-%m-%d')"
query="repo:${GH_REPO} is:issue is:open label:\"need reproduction\" updated:<${cutoff}"
gh api --method GET --paginate /search/issues -f q="${query}" -f per_page=100 --jq '.items[].number' |
while read -r issue_number; do
gh issue close "${issue_number}" --repo "${GH_REPO}"
done