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 3, 2024
1 parent 2ee10b5 commit a7128cd
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions .github/workflows/close-old-issues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,34 @@ jobs:
// Close issues inactive for more than the inactivity period
for (const issue of issues) {
const lastCommentDate = issue.updated_at;
if (new Date(lastCommentDate) < inactivityPeriod) {
try {
// Close the issue
await octokit.rest.issues.update({
owner,
repo,
issue_number: issue.number,
state: 'closed',
});
const labels = await octokit.rest.issues.listLabelsOnIssue({
owner,
repo,
issue.number,
});
console.log(`For Issue #${issue.number} there's labels: ${labels}`);
// const lastCommentDate = issue.updated_at;
// if (new Date(lastCommentDate) < inactivityPeriod) {
// try {
// // Close the issue
// await octokit.rest.issues.update({
// owner,
// repo,
// issue_number: issue.number,
// state: 'closed',
// });
// Add a comment
await octokit.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: 'Closed due to inactivity',
});
} catch (error) {
console.error(`Error updating or commenting on issue #${issue.number}: ${error}`);
}
}
// // Add a comment
// await octokit.rest.issues.createComment({
// owner,
// repo,
// issue_number: issue.number,
// body: 'Closed due to inactivity',
// });
// } catch (error) {
// console.error(`Error updating or commenting on issue #${issue.number}: ${error}`);
// }
// }
}
}
} catch (error) {
Expand Down

0 comments on commit a7128cd

Please sign in to comment.