Merge f98e49720093fe8ba14266530289c9ee4a44dddb into 3f3b0175e8c66fb49b9a6d5a0cd1f8436d4c3ab6

This commit is contained in:
Josh Soref 2023-12-18 09:26:16 +01:00 committed by GitHub
commit 4496d1b4b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 24 deletions

View File

@ -30,7 +30,7 @@ test('processing an issue with no label will make it stale and close it, if it i
expect(processor.closedIssues).toHaveLength(1);
});
test('processing an issue with no label and a start date as ECMAScript epoch in seconds being before the issue creation date will not make it stale nor close it when it is old enough and days-before-close is set to 0', async () => {
test('processing an issue with no label and a start date as ECMAScript epoch in seconds being before the issue creation date will neither make it stale nor close it when it is old enough and days-before-close is set to 0', async () => {
expect.assertions(2);
const january2000 = 946681200000;
const opts: IIssuesProcessorOptions = {
@ -62,7 +62,7 @@ test('processing an issue with no label and a start date as ECMAScript epoch in
expect(processor.closedIssues.length).toStrictEqual(0);
});
test('processing an issue with no label and a start date as ECMAScript epoch in seconds being after the issue creation date will not make it stale nor close it when it is old enough and days-before-close is set to 0', async () => {
test('processing an issue with no label and a start date as ECMAScript epoch in seconds being after the issue creation date will neither make it stale nor close it when it is old enough and days-before-close is set to 0', async () => {
expect.assertions(2);
const january2021 = 1609455600000;
const opts: IIssuesProcessorOptions = {
@ -94,7 +94,7 @@ test('processing an issue with no label and a start date as ECMAScript epoch in
expect(processor.closedIssues.length).toStrictEqual(0);
});
test('processing an issue with no label and a start date as ECMAScript epoch in milliseconds being before the issue creation date will not make it stale nor close it when it is old enough and days-before-close is set to 0', async () => {
test('processing an issue with no label and a start date as ECMAScript epoch in milliseconds being before the issue creation date will neither make it stale nor close it when it is old enough and days-before-close is set to 0', async () => {
expect.assertions(2);
const january2000 = 946681200000000;
const opts: IIssuesProcessorOptions = {
@ -126,7 +126,7 @@ test('processing an issue with no label and a start date as ECMAScript epoch in
expect(processor.closedIssues.length).toStrictEqual(0);
});
test('processing an issue with no label and a start date as ECMAScript epoch in milliseconds being after the issue creation date will not make it stale nor close it when it is old enough and days-before-close is set to 0', async () => {
test('processing an issue with no label and a start date as ECMAScript epoch in milliseconds being after the issue creation date will neither make it stale nor close it when it is old enough and days-before-close is set to 0', async () => {
expect.assertions(2);
const january2021 = 1609455600000;
const opts: IIssuesProcessorOptions = {
@ -190,7 +190,7 @@ test('processing an issue with no label and a start date as ISO 8601 being befor
expect(processor.closedIssues.length).toStrictEqual(1);
});
test('processing an issue with no label and a start date as ISO 8601 being after the issue creation date will not make it stale nor close it when it is old enough and days-before-close is set to 0', async () => {
test('processing an issue with no label and a start date as ISO 8601 being after the issue creation date will neither make it stale nor close it when it is old enough and days-before-close is set to 0', async () => {
expect.assertions(2);
const january2021 = '2021-01-01T00:00:00Z';
const opts: IIssuesProcessorOptions = {
@ -254,7 +254,7 @@ test('processing an issue with no label and a start date as RFC 2822 being befor
expect(processor.closedIssues.length).toStrictEqual(1);
});
test('processing an issue with no label and a start date as RFC 2822 being after the issue creation date will not make it stale nor close it when it is old enough and days-before-close is set to 0', async () => {
test('processing an issue with no label and a start date as RFC 2822 being after the issue creation date will neither make it stale nor close it when it is old enough and days-before-close is set to 0', async () => {
expect.assertions(2);
const january2021 = 'January 1, 2021 00:00:00';
const opts: IIssuesProcessorOptions = {
@ -1442,7 +1442,7 @@ test('stale issues should not be closed until after the closed number of days',
expect(processor.staleIssues).toHaveLength(1);
});
test('stale issues should be closed if the closed nubmer of days (additive) is also passed', async () => {
test('stale issues should be closed if the closed number of days (additive) is also passed', async () => {
const opts = {...DefaultProcessorOptions};
opts.daysBeforeStale = 5; // stale after 5 days
opts.daysBeforeClose = 1; // closes after 6 days

14
dist/index.js vendored
View File

@ -592,8 +592,8 @@ class IssuesProcessor {
return; // Don't process exempt assignees
}
// Ignore draft PR
// Note that this check is so far below because it cost one read operation
// So it's simply better to do all the stale checks which don't cost more operation before this one
// Note that this check is so far below because it costs one read operation
// So it's simply better to do all the stale checks which don't cost an operation before this one
const exemptDraftPullRequest = new exempt_draft_pull_request_1.ExemptDraftPullRequest(this.options, issue);
if (yield exemptDraftPullRequest.shouldExemptDraftPullRequest(() => __awaiter(this, void 0, void 0, function* () {
return this.getPullRequest(issue);
@ -1114,7 +1114,7 @@ class IssuesProcessor {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const issueLogger = new issue_logger_1.IssueLogger(issue);
issueLogger.info(`The $$type is not closed nor locked. Trying to remove the close label...`);
issueLogger.info(`The $$type is neither closed nor locked. Trying to remove the close label...`);
if (!closeLabel) {
issueLogger.info(logger_service_1.LoggerService.white('├──'), `The ${issueLogger.createOptionLink(IssuesProcessor._getCloseLabelUsedOptionName(issue))} option was not set`);
issueLogger.info(logger_service_1.LoggerService.white('└──'), `Skipping the removal of the close label`);
@ -2492,15 +2492,15 @@ function _run() {
const issueProcessor = new issues_processor_1.IssuesProcessor(args, state);
const rateLimitAtStart = yield issueProcessor.getRateLimit();
if (rateLimitAtStart) {
core.debug(`Github API rate status: limit=${rateLimitAtStart.limit}, used=${rateLimitAtStart.used}, remaining=${rateLimitAtStart.remaining}`);
core.debug(`GitHub API rate status: limit=${rateLimitAtStart.limit}, used=${rateLimitAtStart.used}, remaining=${rateLimitAtStart.remaining}`);
}
yield issueProcessor.processIssues();
const rateLimitAtEnd = yield issueProcessor.getRateLimit();
if (rateLimitAtEnd) {
core.debug(`Github API rate status: limit=${rateLimitAtEnd.limit}, used=${rateLimitAtEnd.used}, remaining=${rateLimitAtEnd.remaining}`);
core.debug(`GitHub API rate status: limit=${rateLimitAtEnd.limit}, used=${rateLimitAtEnd.used}, remaining=${rateLimitAtEnd.remaining}`);
if (rateLimitAtStart)
core.info(`Github API rate used: ${rateLimitAtStart.remaining - rateLimitAtEnd.remaining}`);
core.info(`Github API rate remaining: ${rateLimitAtEnd.remaining}; reset at: ${rateLimitAtEnd.reset}`);
core.info(`GitHub API rate used: ${rateLimitAtStart.remaining - rateLimitAtEnd.remaining}`);
core.info(`GitHub API rate remaining: ${rateLimitAtEnd.remaining}; reset at: ${rateLimitAtEnd.reset}`);
}
yield state.persist();
yield processOutput(issueProcessor.staleIssues, issueProcessor.closedIssues);

View File

@ -1,6 +1,6 @@
# Contributors
### Checkin
### Check-in
- Do check in source (src)
- Do not check in build output (lib)

View File

@ -429,8 +429,8 @@ export class IssuesProcessor {
}
// Ignore draft PR
// Note that this check is so far below because it cost one read operation
// So it's simply better to do all the stale checks which don't cost more operation before this one
// Note that this check is so far below because it costs one read operation
// So it's simply better to do all the stale checks which don't cost an operation before this one
const exemptDraftPullRequest: ExemptDraftPullRequest =
new ExemptDraftPullRequest(this.options, issue);
@ -1196,7 +1196,7 @@ export class IssuesProcessor {
const issueLogger: IssueLogger = new IssueLogger(issue);
issueLogger.info(
`The $$type is not closed nor locked. Trying to remove the close label...`
`The $$type is neither closed nor locked. Trying to remove the close label...`
);
if (!closeLabel) {

View File

@ -131,7 +131,7 @@ describe('isLabeled()', (): void => {
});
});
describe('when the given issue contains a label wih diacritical marks', (): void => {
describe('when the given issue contains a label with diacritical marks', (): void => {
beforeEach((): void => {
issue = {
labels: [
@ -170,7 +170,7 @@ describe('isLabeled()', (): void => {
});
});
describe('when the given issue contains a label wih diacritical marks', (): void => {
describe('when the given issue contains a label with diacritical marks', (): void => {
beforeEach((): void => {
label = 'déjà vu';
});

View File

@ -17,7 +17,7 @@ async function _run(): Promise<void> {
const rateLimitAtStart = await issueProcessor.getRateLimit();
if (rateLimitAtStart) {
core.debug(
`Github API rate status: limit=${rateLimitAtStart.limit}, used=${rateLimitAtStart.used}, remaining=${rateLimitAtStart.remaining}`
`GitHub API rate status: limit=${rateLimitAtStart.limit}, used=${rateLimitAtStart.used}, remaining=${rateLimitAtStart.remaining}`
);
}
@ -27,18 +27,18 @@ async function _run(): Promise<void> {
if (rateLimitAtEnd) {
core.debug(
`Github API rate status: limit=${rateLimitAtEnd.limit}, used=${rateLimitAtEnd.used}, remaining=${rateLimitAtEnd.remaining}`
`GitHub API rate status: limit=${rateLimitAtEnd.limit}, used=${rateLimitAtEnd.used}, remaining=${rateLimitAtEnd.remaining}`
);
if (rateLimitAtStart)
core.info(
`Github API rate used: ${
`GitHub API rate used: ${
rateLimitAtStart.remaining - rateLimitAtEnd.remaining
}`
);
core.info(
`Github API rate remaining: ${rateLimitAtEnd.remaining}; reset at: ${rateLimitAtEnd.reset}`
`GitHub API rate remaining: ${rateLimitAtEnd.remaining}; reset at: ${rateLimitAtEnd.reset}`
);
}