From a7128cd4271912d14821bf5861da4b673a0b5833 Mon Sep 17 00:00:00 2001 From: "Mr.k" Date: Thu, 4 Apr 2024 01:39:38 +0300 Subject: [PATCH] Update Github Actions Auto Close Issues --- .github/workflows/close-old-issues.yaml | 48 ++++++++++++++----------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/.github/workflows/close-old-issues.yaml b/.github/workflows/close-old-issues.yaml index 1b129a0abc..52a191a4f3 100644 --- a/.github/workflows/close-old-issues.yaml +++ b/.github/workflows/close-old-issues.yaml @@ -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) {