mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-03-15 14:05:47 -05:00
Replace fabricbot with GHA for scheduled issue closing (#54566)
Co-authored-by: Ryan Cavanaugh <RyanCavanaugh@users.noreply.github.com>
This commit is contained in:
43
.github/workflows/close-issues.yml
vendored
Normal file
43
.github/workflows/close-issues.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
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
|
||||
run: |
|
||||
DATE=$(date --date='2 days ago' --iso-8601)
|
||||
|
||||
close_issues() {
|
||||
echo "Closing issues marked as '$1'."
|
||||
for issue in $(gh issue list --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 --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"
|
||||
Reference in New Issue
Block a user