Skip to content

Commit ff7cb5c

Browse files
authored
Merge branch 'main' into rejecttoken
Signed-off-by: aceppaluni <113948612+aceppaluni@users.noreply.github.com>
2 parents 1af88ec + 1b15756 commit ff7cb5c

83 files changed

Lines changed: 2981 additions & 2273 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/scripts/__tests__/jest/bot-contributor-lifecycle.test.js

Lines changed: 678 additions & 0 deletions
Large diffs are not rendered by default.

.github/scripts/bot-contributor-lifecycle.js

Lines changed: 774 additions & 0 deletions
Large diffs are not rendered by default.

.github/scripts/bot-inactivity-unassign.sh

Lines changed: 0 additions & 275 deletions
This file was deleted.

.github/scripts/cron-enforcer-pr-linked-issue.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
// A script to closes pull requests without a linked issue after 24 hours automatically.
1+
// A script to closes pull requests without a linked issue after 2 hours automatically.
22

33
// dryRun env var: any case-insensitive 'true' value will enable dry-run
44
const dryRun = (process.env.DRY_RUN || 'false').toString().toLowerCase() === 'true';
5-
const hoursBeforeClose = parseInt(process.env.HOURS_BEFORE_CLOSE || '24', 10);
5+
const immediateCheck =
6+
(process.env.IMMEDIATE_CHECK || 'false').toLowerCase() === 'true';
7+
const hoursBeforeClose = parseInt(process.env.HOURS_BEFORE_CLOSE || '2', 10);
68
const requireAuthorAssigned = (process.env.REQUIRE_AUTHOR_ASSIGNED || 'true').toLowerCase() === 'true';
79

810
const getHoursOpen = (pr) =>
@@ -88,6 +90,14 @@ async function closePR(github, pr, owner, repo, reason) {
8890
owner, repo, issue_number: pr.number,
8991
body: messages[reason]
9092
});
93+
94+
if (immediateCheck) {
95+
console.log(
96+
`✓ Commented on PR #${pr.number} (${reason}) link: ${pr.html_url}`
97+
);
98+
return;
99+
}
100+
91101
await github.rest.pulls.update({
92102
owner, repo, pull_number: pr.number, state: 'closed'
93103
});
@@ -119,8 +129,10 @@ module.exports = async ({ github, context }) => {
119129
}
120130

121131
const hours = getHoursOpen(pr);
122-
if (hours < hoursBeforeClose) {
123-
console.log(`PR #${pr.number} link: ${pr.html_url} is only ${hours} hours old. Skipping.`);
132+
if (!immediateCheck && hours < hoursBeforeClose) {
133+
console.log(
134+
`PR #${pr.number} link: ${pr.html_url} is only ${hours} hours old. Skipping.`
135+
);
124136
continue;
125137
}
126138

0 commit comments

Comments
 (0)