diff --git a/.github/workflows/close-old-issues.yaml b/.github/workflows/close-old-issues.yaml index 1b129a0abc..d20635c201 100644 --- a/.github/workflows/close-old-issues.yaml +++ b/.github/workflows/close-old-issues.yaml @@ -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; @@ -36,8 +37,15 @@ 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({