-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. | ||
# | ||
# You can adjust the behavior by modifying this file. | ||
# For more information, see: | ||
# https://github.com/actions/stale | ||
name: Close old issues | ||
on: | ||
schedule: | ||
- cron: "0 0 * * *" # 매일 자정에 실행 | ||
|
||
jobs: | ||
close-issues: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Close old issues | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const now = new Date(); | ||
const sevenDaysAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000); | ||
const { data: openIssues } = await github.rest.issues.listForRepo({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: 'open', | ||
}); | ||
for (const issue of openIssues) { | ||
if (new Date(issue.created_at) < sevenDaysAgo) { | ||
await github.rest.issues.update({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issue.number, | ||
state: 'closed', | ||
state_reason: 'not_planned' | ||
}); | ||
} | ||
} |