github: Temporarily disable close_reviewer_needed automation

Temporarily disable the closing of PRs marked as "reviewer needed".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2023-12-05 17:55:11 -05:00
parent fc102edc24
commit 0ccf5f8e47
1 changed files with 48 additions and 48 deletions

View File

@ -62,54 +62,54 @@ jobs:
state: 'closed' state: 'closed'
}); });
} }
# Close tickets marked with "reviewer needed" label for 2+ weeks # # Close tickets marked with "reviewer needed" label for 2+ weeks
close_reviewer_needed: # close_reviewer_needed:
if: github.repository == 'Klipper3d/klipper' # if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest # runs-on: ubuntu-latest
steps: # steps:
- uses: actions/github-script@v6 # - uses: actions/github-script@v6
with: # with:
script: | # script: |
const issues = await github.rest.issues.listForRepo({ # const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner, # owner: context.repo.owner,
repo: context.repo.repo, # repo: context.repo.repo,
state: 'open', # state: 'open',
labels: 'reviewer needed', # labels: 'reviewer needed',
assignee: 'none', # assignee: 'none',
per_page: 100, # per_page: 100,
page: 1 # page: 1
}); # });
msg = "Unfortunately a reviewer has not assigned themselves to" # msg = "Unfortunately a reviewer has not assigned themselves to"
+ " this GitHub Pull Request and it is therefore being" # + " this GitHub Pull Request and it is therefore being"
+ " closed. It is a good idea to move" # + " closed. It is a good idea to move"
+ " further discussion to the [Klipper Discourse]" # + " further discussion to the [Klipper Discourse]"
+ "(https://www.klipper3d.org/Contact.html#discourse-forum)" # + "(https://www.klipper3d.org/Contact.html#discourse-forum)"
+ " server. Reviewers can reach out on that forum to let you" # + " server. Reviewers can reach out on that forum to let you"
+ " know if they are interested and when they are available." # + " know if they are interested and when they are available."
+ "\n\n" # + "\n\n"
+ "Best regards,\n" # + "Best regards,\n"
+ "~ Your friendly GitIssueBot" # + "~ Your friendly GitIssueBot"
+ "\n\n" # + "\n\n"
+ "PS: I'm just an automated script, not a human being."; # + "PS: I'm just an automated script, not a human being.";
const expireMillis = 1000 * 60 * 60 * 24 * 14; # const expireMillis = 1000 * 60 * 60 * 24 * 14;
const curtime = new Date().getTime(); # const curtime = new Date().getTime();
for (const issue of issues.data.values()) { # for (const issue of issues.data.values()) {
const updatetime = new Date(issue.updated_at).getTime(); # const updatetime = new Date(issue.updated_at).getTime();
if (curtime < updatetime + expireMillis) # if (curtime < updatetime + expireMillis)
continue; # continue;
await github.rest.issues.createComment({ # await github.rest.issues.createComment({
owner: context.repo.owner, # owner: context.repo.owner,
repo: context.repo.repo, # repo: context.repo.repo,
issue_number: issue.number, # issue_number: issue.number,
body: msg # body: msg
}); # });
await github.rest.issues.update({ # await github.rest.issues.update({
owner: context.repo.owner, # owner: context.repo.owner,
repo: context.repo.repo, # repo: context.repo.repo,
issue_number: issue.number, # issue_number: issue.number,
state: 'closed' # state: 'closed'
}); # });
} # }
# Mark unassigned PRs that are idle for 2 weeks # Mark unassigned PRs that are idle for 2 weeks
mark_reviewer_needed: mark_reviewer_needed:
if: github.repository == 'Klipper3d/klipper' if: github.repository == 'Klipper3d/klipper'