diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2022-03-13 14:23:12 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2022-03-13 17:13:56 -0400 |
commit | 341e56dcea178ec2b269528ba1ad2978cfdc4b15 (patch) | |
tree | b1618cea39654479910847f7a6c0b24a6122c200 | |
parent | cc3c4c81e94f4dd32cf47c764883806897e11586 (diff) | |
download | kutter-341e56dcea178ec2b269528ba1ad2978cfdc4b15.tar.gz kutter-341e56dcea178ec2b269528ba1ad2978cfdc4b15.tar.xz kutter-341e56dcea178ec2b269528ba1ad2978cfdc4b15.zip |
workflows: Automatically close PRs with "reviewer needed" that become stale
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | .github/workflows/stale-issue-bot.yaml | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/.github/workflows/stale-issue-bot.yaml b/.github/workflows/stale-issue-bot.yaml index 57dba3cc..8cc3062f 100644 --- a/.github/workflows/stale-issue-bot.yaml +++ b/.github/workflows/stale-issue-bot.yaml @@ -60,6 +60,54 @@ jobs: state: 'closed' }); } + # Close tickets marked with "reviewer needed" label for 2+ weeks + close_reviewer_needed: + if: github.repository == 'Klipper3d/klipper' + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + with: + script: | + const issues = await github.rest.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open', + labels: 'reviewer needed', + assignee: 'none', + per_page: 100, + page: 1 + }); + msg = "Unfortunately a reviewer has not assigned themselves to" + + " this GitHub Pull Request and it is therefore being" + + " closed. It is a good idea to move" + + " further discussion to the [Klipper Discourse]" + + "(https://www.klipper3d.org/Contact.html#community-forum)" + + " server. Reviewers can reach out on that forum to let you" + + " know if they are interested and when they are available." + + "\n\n" + + "Best regards,\n" + + "~ Your friendly GitIssueBot" + + "\n\n" + + "PS: I'm just an automated script, not a human being."; + const expireMillis = 1000 * 60 * 60 * 24 * 14; + const curtime = new Date().getTime(); + for (const issue of issues.data.values()) { + const updatetime = new Date(issue.updated_at).getTime(); + if (curtime < updatetime + expireMillis) + continue; + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + body: msg + }); + await github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + state: 'closed' + }); + } # Close tickets marked with "resolved" label close_resolved: if: github.repository == 'Klipper3d/klipper' |