-
-
Notifications
You must be signed in to change notification settings - Fork 255
39 lines (33 loc) · 990 Bytes
/
issue-close-require.yml
File metadata and controls
39 lines (33 loc) · 990 Bytes
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
name: Issue Close Require
on:
schedule:
- cron: '0 0 * * *'
permissions:
contents: read
issues: write
jobs:
close-issues:
runs-on: ubuntu-latest
steps:
- name: need reproduction
env:
GH_TOKEN: ${{ github.token }}
INACTIVE_DAYS: 3
LABEL: need reproduction
REPO: ${{ github.repository }}
run: |
set -o pipefail
cutoff="$(date -u -d "$INACTIVE_DAYS days ago" +%s)"
gh issue list \
--repo "$REPO" \
--state open \
--label "$LABEL" \
--limit 1000 \
--json number,updatedAt \
--jq '.[] | [.number, .updatedAt] | @tsv' \
| while IFS=$'\t' read -r number updated_at; do
updated_at_epoch="$(date -u -d "$updated_at" +%s)"
if [ "$updated_at_epoch" -le "$cutoff" ]; then
gh issue close "$number" --repo "$REPO"
fi
done