workflows: Update stale-issue-bot.yaml to use actions/github-script@v6

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-03-13 17:09:08 -04:00
parent 2f8f99acae
commit 021459e53e
1 changed files with 51 additions and 51 deletions

View File

@ -36,10 +36,12 @@ jobs:
if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
- uses: actions/github-script@v6
with:
script: |
const issues = await github.issues.listForRepo({
const expireMillis = 1000 * 60 * 60 * 36;
const curtime = new Date().getTime();
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
@ -47,13 +49,11 @@ jobs:
per_page: 100,
page: 1
});
const expireMillis = 1000 * 60 * 60 * 36;
const curtime = new Date().getTime();
for (var issue of issues.data.values()) {
for (const issue of issues.data.values()) {
const updatetime = new Date(issue.updated_at).getTime();
if (curtime < updatetime + expireMillis)
continue;
await github.issues.update({
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
@ -148,23 +148,9 @@ jobs:
if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
- uses: actions/github-script@v6
with:
script: |
const issues = await github.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'resolved',
per_page: 100,
page: 1
});
const expireMillis = 1000 * 60 * 60 * 24 * 7;
const curtime = new Date().getTime();
for (var issue of issues.data.values()) {
const updatetime = new Date(issue.updated_at).getTime();
if (curtime < updatetime + expireMillis)
continue;
msg = "This ticket is being closed because the underlying issue"
+ " is now thought to be resolved."
+ "\n\n"
@ -172,13 +158,27 @@ jobs:
+ "~ Your friendly GitIssueBot"
+ "\n\n"
+ "PS: I'm just an automated script, not a human being.";
await github.issues.createComment({
const expireMillis = 1000 * 60 * 60 * 24 * 7;
const curtime = new Date().getTime();
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'resolved',
per_page: 100,
page: 1
});
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.issues.update({
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
@ -190,23 +190,9 @@ jobs:
if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
- uses: actions/github-script@v6
with:
script: |
const issues = await github.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'not mainline',
per_page: 100,
page: 1
});
const expireMillis = 1000 * 60 * 60 * 24 * 7;
const curtime = new Date().getTime();
for (var issue of issues.data.values()) {
const updatetime = new Date(issue.updated_at).getTime();
if (curtime < updatetime + expireMillis)
continue;
msg = "This PR is being closed because it is currently not"
+ " considered a good match for the master Klipper"
+ " repository."
@ -215,13 +201,27 @@ jobs:
+ "~ Your friendly GitIssueBot"
+ "\n\n"
+ "PS: I'm just an automated script, not a human being.";
await github.issues.createComment({
const expireMillis = 1000 * 60 * 60 * 24 * 7;
const curtime = new Date().getTime();
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'not mainline',
per_page: 100,
page: 1
});
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.issues.update({
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
@ -233,23 +233,9 @@ jobs:
if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
- uses: actions/github-script@v6
with:
script: |
const issues = await github.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'pending feedback',
per_page: 100,
page: 1
});
const expireMillis = 1000 * 60 * 60 * 24 * 21;
const curtime = new Date().getTime();
for (var issue of issues.data.values()) {
const updatetime = new Date(issue.updated_at).getTime();
if (curtime < updatetime + expireMillis)
continue;
msg = "It looks like this GitHub Pull Request has become"
+ " inactive. If there are any further updates, you can"
+ " add a comment here or open a new ticket."
@ -258,19 +244,33 @@ jobs:
+ "~ Your friendly GitIssueBot"
+ "\n\n"
+ "PS: I'm just an automated script, not a human being.";
await github.issues.addLabels({
const expireMillis = 1000 * 60 * 60 * 24 * 21;
const curtime = new Date().getTime();
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'pending feedback',
per_page: 100,
page: 1
});
for (const issue of issues.data.values()) {
const updatetime = new Date(issue.updated_at).getTime();
if (curtime < updatetime + expireMillis)
continue;
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: ['inactive']
});
await github.issues.createComment({
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: msg
});
await github.issues.update({
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,