forked from microsoft/TypeScript
-
-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (43 loc) · 1.67 KB
/
close-issues.yml
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
name: Close issues
on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
permissions:
contents: read
# Ensure scripts are run with pipefail. See:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
defaults:
run:
shell: bash
jobs:
close-issues:
runs-on: ubuntu-latest
if: github.repository == 'microsoft/TypeScript'
permissions:
contents: read # Apparently required to create issues
issues: write
steps:
- name: Close issues
env:
GH_TOKEN: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
run: |
DATE=$(date --date='2 days ago' --iso-8601)
close_issues() {
echo "Closing issues marked as '$1'."
for issue in $(gh issue list --limit 100 --label "$1" --repo ${{ github.repository }} --state open --search "updated:<$DATE" --json number --jq '.[].number'); do
echo "Closing https://github.com/${{ github.repository }}/issues/$issue"
gh issue close $issue --repo ${{ github.repository }} --reason "not planned" --comment "This issue has been marked as \"$1\" and has seen no recent activity. It has been automatically closed for house-keeping purposes."
done
}
close_issues "Duplicate"
close_issues "Unactionable"
close_issues "Not a Defect"
close_issues "External"
close_issues "Working as Intended"
close_issues "Question"
close_issues "Out of Scope"
close_issues "Declined"
close_issues "Won't Fix"
close_issues "Too Complex"
close_issues "Design Limitation"