Skip to content

Commit

Permalink
Update Github Actions Auto Close Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
og-mrk committed Apr 1, 2024
1 parent 2ee10b5 commit bdac026
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/close-old-issues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const octokit = github;
const labelExcludeName = "Keep Issue Open"
// Get the repository owner and name
const { owner, repo } = context.repo;
Expand All @@ -36,8 +37,14 @@ jobs:
// Close issues inactive for more than the inactivity period
for (const issue of issues) {
for (const label in issue.labels) {
if (label === labelExcludeName) {
console.log( "Issue won't be closed." );
return
}
const lastCommentDate = issue.updated_at;
if (new Date(lastCommentDate) < inactivityPeriod) {
# TODO: Please remove the 'new Date.now()' and replace it with 'inactivityPeriod', this is done for testing purposes
if (new Date(lastCommentDate) < new Date.now()) {
try {
// Close the issue
await octokit.rest.issues.update({
Expand Down

0 comments on commit bdac026

Please sign in to comment.