Fix per issue operation count (#662)
* Fix per issue operation count * Run pack
This commit is contained in:
parent
04a1828bc1
commit
7a7efcae1f
|
@ -9,7 +9,7 @@ export class IssuesProcessorMock extends IssuesProcessor {
|
||||||
options: IIssuesProcessorOptions,
|
options: IIssuesProcessorOptions,
|
||||||
getIssues?: (page: number) => Promise<Issue[]>,
|
getIssues?: (page: number) => Promise<Issue[]>,
|
||||||
listIssueComments?: (
|
listIssueComments?: (
|
||||||
issueNumber: number,
|
issue: Issue,
|
||||||
sinceDate: string
|
sinceDate: string
|
||||||
) => Promise<IComment[]>,
|
) => Promise<IComment[]>,
|
||||||
getLabelCreationDate?: (
|
getLabelCreationDate?: (
|
||||||
|
|
|
@ -613,17 +613,17 @@ class IssuesProcessor {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Grab comments for an issue since a given date
|
// Grab comments for an issue since a given date
|
||||||
listIssueComments(issueNumber, sinceDate) {
|
listIssueComments(issue, sinceDate) {
|
||||||
var _a;
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Find any comments since date on the given issue
|
// Find any comments since date on the given issue
|
||||||
try {
|
try {
|
||||||
this.operations.consumeOperation();
|
this._consumeIssueOperation(issue);
|
||||||
(_a = this.statistics) === null || _a === void 0 ? void 0 : _a.incrementFetchedItemsCommentsCount();
|
(_a = this.statistics) === null || _a === void 0 ? void 0 : _a.incrementFetchedItemsCommentsCount();
|
||||||
const comments = yield this.client.issues.listComments({
|
const comments = yield this.client.issues.listComments({
|
||||||
owner: github_1.context.repo.owner,
|
owner: github_1.context.repo.owner,
|
||||||
repo: github_1.context.repo.repo,
|
repo: github_1.context.repo.repo,
|
||||||
issue_number: issueNumber,
|
issue_number: issue.number,
|
||||||
since: sinceDate
|
since: sinceDate
|
||||||
});
|
});
|
||||||
return comments.data;
|
return comments.data;
|
||||||
|
@ -763,7 +763,7 @@ class IssuesProcessor {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// find any comments since the date
|
// find any comments since the date
|
||||||
const comments = yield this.listIssueComments(issue.number, sinceDate);
|
const comments = yield this.listIssueComments(issue, sinceDate);
|
||||||
const filteredComments = comments.filter(comment => comment.user.type === 'User' &&
|
const filteredComments = comments.filter(comment => comment.user.type === 'User' &&
|
||||||
comment.body.toLowerCase() !== staleMessage.toLowerCase());
|
comment.body.toLowerCase() !== staleMessage.toLowerCase());
|
||||||
issueLogger.info(`Comments that are not the stale comment or another bot: ${logger_service_1.LoggerService.cyan(filteredComments.length)}`);
|
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 {
|
||||||
issueLogger.info(`Adding all the labels specified via the ${this._logger.createOptionLink(option_1.Option.LabelsToAddWhenUnstale)} option.`);
|
issueLogger.info(`Adding all the labels specified via the ${this._logger.createOptionLink(option_1.Option.LabelsToAddWhenUnstale)} option.`);
|
||||||
this.addedLabelIssues.push(issue);
|
this.addedLabelIssues.push(issue);
|
||||||
try {
|
try {
|
||||||
this.operations.consumeOperation();
|
this._consumeIssueOperation(issue);
|
||||||
(_a = this.statistics) === null || _a === void 0 ? void 0 : _a.incrementAddedItemsLabel(issue);
|
(_a = this.statistics) === null || _a === void 0 ? void 0 : _a.incrementAddedItemsLabel(issue);
|
||||||
if (!this.options.debugOnly) {
|
if (!this.options.debugOnly) {
|
||||||
yield this.client.issues.addLabels({
|
yield this.client.issues.addLabels({
|
||||||
|
|
|
@ -510,17 +510,17 @@ export class IssuesProcessor {
|
||||||
|
|
||||||
// Grab comments for an issue since a given date
|
// Grab comments for an issue since a given date
|
||||||
async listIssueComments(
|
async listIssueComments(
|
||||||
issueNumber: Readonly<number>,
|
issue: Readonly<Issue>,
|
||||||
sinceDate: Readonly<string>
|
sinceDate: Readonly<string>
|
||||||
): Promise<IComment[]> {
|
): Promise<IComment[]> {
|
||||||
// Find any comments since date on the given issue
|
// Find any comments since date on the given issue
|
||||||
try {
|
try {
|
||||||
this.operations.consumeOperation();
|
this._consumeIssueOperation(issue);
|
||||||
this.statistics?.incrementFetchedItemsCommentsCount();
|
this.statistics?.incrementFetchedItemsCommentsCount();
|
||||||
const comments = await this.client.issues.listComments({
|
const comments = await this.client.issues.listComments({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
issue_number: issueNumber,
|
issue_number: issue.number,
|
||||||
since: sinceDate
|
since: sinceDate
|
||||||
});
|
});
|
||||||
return comments.data;
|
return comments.data;
|
||||||
|
@ -734,7 +734,7 @@ export class IssuesProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// find any comments since the date
|
// find any comments since the date
|
||||||
const comments = await this.listIssueComments(issue.number, sinceDate);
|
const comments = await this.listIssueComments(issue, sinceDate);
|
||||||
|
|
||||||
const filteredComments = comments.filter(
|
const filteredComments = comments.filter(
|
||||||
comment =>
|
comment =>
|
||||||
|
@ -1065,7 +1065,7 @@ export class IssuesProcessor {
|
||||||
this.addedLabelIssues.push(issue);
|
this.addedLabelIssues.push(issue);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.operations.consumeOperation();
|
this._consumeIssueOperation(issue);
|
||||||
this.statistics?.incrementAddedItemsLabel(issue);
|
this.statistics?.incrementAddedItemsLabel(issue);
|
||||||
if (!this.options.debugOnly) {
|
if (!this.options.debugOnly) {
|
||||||
await this.client.issues.addLabels({
|
await this.client.issues.addLabels({
|
||||||
|
|
Loading…
Reference in New Issue