8000 Fix per issue operation count (#662) · actions/stale@7a7efca · GitHub
[go: up one dir, main page]

Skip to content

Commit 7a7efca

Browse files
authored
Fix per issue operation count (#662)
* Fix per issue operation count * Run pack
1 parent 04a1828 commit 7a7efca

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

__tests__/classes/issues-processor-mock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class IssuesProcessorMock extends IssuesProcessor {
99
options: IIssuesProcessorOptions,
1010
getIssues?: (page: number) => Promise<Issue[]>,
1111
listIssueComments?: (
12-
issueNumber: number,
12+
issue: Issue,
1313
sinceDate: string
1414
) => Promise<IComment[]>,
1515
getLabelCreationDate?: (

dist/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -613,17 +613,17 @@ class IssuesProcessor {
613613
});
614614
}
615615
// Grab comments for an issue since a given date
616-
listIssueComments(issueNumber, sinceDate) {
616+
listIssueComments(issue, sinceDate) {
617617
var _a;
618618
return __awaiter(this, void 0, void 0, function* () {
619619
// Find any comments since date on the given issue
620620
try {
621-
this.operations.consumeOperation();
621+
this._consumeIssueOperation(issue);
622622
(_a = this.statistics) === null || _a === void 0 ? void 0 : _a.incrementFetchedItemsCommentsCount();
623623
const comments = yield this.client.issues.listComments({
624624
owner: github_1.context.repo.owner,
625625
repo: github_1.context.repo.repo,
626-
issue_number: issueNumber,
626+
issue_number: issue.number,
627627
since: sinceDate
628628
});
629629
return comments.data;
@@ -763,7 +763,7 @@ class IssuesProcessor {
763763
return true;
764764
}
765765
// find any comments since the date
766-
const comments = yield this.listIssueComments(issue.number, sinceDate);
766+
const comments = yield this.listIssueComments(issue, sinceDate);
767767
const filteredComments = comments.filter(comment => comment.user.type === 'User' &&
768768
comment.body.toLowerCase() !== staleMessage.toLowerCase());
769769
issueLogger.info(`Comments that are not the stale comment or another bot: ${logger_service_1.LoggerService.cyan(filteredComments.length)}`);
@@ -1014,7 +1014,7 @@ class IssuesProcessor {
10141014
issueLogger.info(`Adding all the labels specified via the ${this._logger.createOptionLink(option_1.Option.LabelsToAddWhenUnstale)} option.`);
10151015
this.addedLabelIssues.push(issue);
10161016
try {
1017-
this.operations.consumeOperation();
1017+
this._consumeIssueOperation(issue);
10181018
(_a = this.statistics) === null || _a === void 0 ? void 0 : _a.incrementAddedItemsLabel(issue);
10191019
if (!this.options.debugOnly) {
10201020
yield this.client.issues.addLabels({

src/classes/issues-processor.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,17 +510,17 @@ export class IssuesProcessor {
510510

511511
// Grab comments for an issue since a given date
512512
async listIssueComments(
513-
issueNumber: Readonly<number>,
513+
issue: Readonly<Issue>,
514514
sinceDate: Readonly<string>
515515
): Promise<IComment[]> {
516516
// Find any comments since date on the given issue
517517
try {
518-
this.operations.consumeOperation();
518+
this._consumeIssueOperation(issue);
519519
this.statistics?.incrementFetchedItemsCommentsCount();
520520
const comments = await this.client.issues.listComments({
521521
owner: context.repo.owner,
522522
repo: context.repo.repo,
523-
issue_number: issueNumber,
523+
issue_number: issue.number,
524524
since: sinceDate
525525
});
526526
return comments.data;
@@ -734,7 +734,7 @@ export class IssuesProcessor {
734734
}
735735

736736
// find any comments since the date
737-
const comments = await this.listIssueComments(issue.number, sinceDate);
737+
const comments = await this.listIssueComments(issue, sinceDate);
738738

739739
const filteredComments = comments.filter(
740740
comment =>
@@ -1065,7 +1065,7 @@ export class IssuesProcessor {
10651065
this.addedLabelIssues.push(issue);
10661066

10671067
try {
1068-
this.operations.consumeOperation();
1068+
this._consumeIssueOperation(issue);
10691069
this.statistics?.incrementAddedItemsLabel(issue);
10701070
if (!this.options.debugOnly) {
10711071
await this.client.issues.addLabels({

0 commit comments

Comments
 (0)
0