From c50cdd62706ed00a2bb9e1201ac8aac1b71e9a16 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 27 Apr 2023 22:07:44 +0200 Subject: ci: replace stale bot with custom implementation The stale action has a bug where it won't close an issue/PR if it has comments after the stale label. --- .github/scripts/remove_response_label.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/scripts/remove_response_label.js (limited to '.github/scripts/remove_response_label.js') diff --git a/.github/scripts/remove_response_label.js b/.github/scripts/remove_response_label.js new file mode 100644 index 0000000000..f645fca5cb --- /dev/null +++ b/.github/scripts/remove_response_label.js @@ -0,0 +1,19 @@ +module.exports = async ({ github, context }) => { + const commenter = context.actor; + const issue = await github.rest.issues.get({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + const author = issue.data.user.login; + const labels = issue.data.labels.map((e) => e.name); + + if (author === commenter && labels.includes("needs:response")) { + github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + name: "needs:response", + }); + } +}; -- cgit