Skip to content

Commit

Permalink
Add rebuilt index
Browse files Browse the repository at this point in the history
  • Loading branch information
hross committed Feb 5, 2021
1 parent d21d307 commit 9d6f465
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 31 deletions.
45 changes: 15 additions & 30 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2273,12 +2273,7 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss
let issueDate = new Date();
issueDate.setDate(issueDate.getDate() - 2);
const TestIssueList: Issue[] = [
generateIssue(
opts,
1,
'An issue with no label',
issueDate.toDateString(),
)
generateIssue(opts, 1, 'An issue with no label', issueDate.toDateString())
];
const processor = new IssueProcessor(
opts,
Expand All @@ -2287,10 +2282,10 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss
async (num, dt) => [],
async (issue, label) => new Date().toDateString()
);

// process our fake issue list
await processor.processIssues(1);

expect(processor.staleIssues.length).toEqual(0);
expect(processor.closedIssues.length).toEqual(0);
});
Expand All @@ -2305,12 +2300,7 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss
let issueDate = new Date();
issueDate.setDate(issueDate.getDate() - 2);
const TestIssueList: Issue[] = [
generateIssue(
opts,
1,
'An issue with no label',
issueDate.toDateString(),
)
generateIssue(opts, 1, 'An issue with no label', issueDate.toDateString())
];
const processor = new IssueProcessor(
opts,
Expand All @@ -2319,10 +2309,10 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss
async (num, dt) => [],
async (issue, label) => new Date().toDateString()
);

// process our fake issue list
await processor.processIssues(1);

expect(processor.staleIssues.length).toEqual(1);
expect(processor.closedIssues.length).toEqual(0);
});
Expand All @@ -2337,12 +2327,7 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss
let issueDate = new Date();
issueDate.setDate(issueDate.getDate() - 2);
const TestIssueList: Issue[] = [
generateIssue(
opts,
1,
'An issue with no label',
issueDate.toDateString(),
)
generateIssue(opts, 1, 'An issue with no label', issueDate.toDateString())
];
const processor = new IssueProcessor(
opts,
Expand All @@ -2351,10 +2336,10 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss
async (num, dt) => [],
async (issue, label) => new Date().toDateString()
);

// process our fake issue list
await processor.processIssues(1);

expect(processor.staleIssues.length).toEqual(1);
expect(processor.closedIssues.length).toEqual(0);
});
Expand Down Expand Up @@ -2385,10 +2370,10 @@ test('processing a pull request opened since 2 days and with the option "daysBef
async (num, dt) => [],
async (issue, label) => new Date().toDateString()
);

// process our fake issue list
await processor.processIssues(1);

expect(processor.staleIssues.length).toEqual(0);
expect(processor.closedIssues.length).toEqual(0);
});
Expand Down Expand Up @@ -2419,10 +2404,10 @@ test('processing a pull request opened since 2 days and with the option "daysBef
async (num, dt) => [],
async (issue, label) => new Date().toDateString()
);

// process our fake issue list
await processor.processIssues(1);

expect(processor.staleIssues.length).toEqual(1);
expect(processor.closedIssues.length).toEqual(0);
});
Expand Down Expand Up @@ -2453,10 +2438,10 @@ test('processing a pull request opened since 2 days and with the option "daysBef
async (num, dt) => [],
async (issue, label) => new Date().toDateString()
);

// process our fake issue list
await processor.processIssues(1);

expect(processor.staleIssues.length).toEqual(1);
expect(processor.closedIssues.length).toEqual(0);
});
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,16 @@ class IssueProcessor {
continue; // don't process exempt milestones
}
// should this issue be marked stale?
const shouldBeStale = !IssueProcessor._updatedSince(issue.updated_at, this.options.daysBeforeStale);
const shouldBeStale = !IssueProcessor._updatedSince(issue.updated_at, daysBeforeStale);
// determine if this issue needs to be marked stale first
if (!issue.isStale && shouldBeStale && shouldMarkAsStale) {
issueLogger.info(`Marking ${issueType} stale because it was last updated on ${issue.updated_at} and it does not have a stale label`);
yield this._markStale(issue, staleMessage, staleLabel, skipMessage);
issue.isStale = true; // this issue is now considered stale
}
else if (!issue.isStale) {
issueLogger.info(`Not marking as stale: shouldBeStale=${shouldBeStale}, shouldMarkAsStale=${shouldMarkAsStale}`);
}
// process the issue if it was marked stale
if (issue.isStale) {
issueLogger.info(`Found a stale ${issueType}`);
Expand Down

0 comments on commit 9d6f465

Please sign in to comment.