🎨 Add message grouping (#483)
* 🎨 add message grouping * ⚗️ try output * 🔥 remove unnecessary code * ⬆️ bump deps * 🎨 build project * ⬆️ bump deps * 🎨 formatting code * ⬇️ revert bumps * 🎨 using logger service * 🎨 using package lock version 1 * 🎨 add engines keyword * ♻️ create processIssue method * ✨ add grouping method * 🎨 build project * 🎨 update engine declaration * 💚 fix merge conflicts
This commit is contained in:
parent
5f6f311ca6
commit
52f5648db3
|
@ -1112,14 +1112,12 @@ class IssuesProcessorBuilder {
|
|||
|
||||
issues(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this.issuesOrPrs(
|
||||
issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
issues.map((issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
return {
|
||||
...issue,
|
||||
pull_request: null
|
||||
};
|
||||
}
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
return this;
|
||||
|
@ -1127,14 +1125,12 @@ class IssuesProcessorBuilder {
|
|||
|
||||
prs(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this.issuesOrPrs(
|
||||
issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
issues.map((issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
return {
|
||||
...issue,
|
||||
pull_request: {key: 'value'}
|
||||
};
|
||||
}
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
return this;
|
||||
|
|
|
@ -32,12 +32,10 @@ export function generateIssue(
|
|||
title: milestone
|
||||
}
|
||||
: undefined,
|
||||
assignees: assignees.map(
|
||||
(assignee: Readonly<string>): IAssignee => {
|
||||
assignees: assignees.map((assignee: Readonly<string>): IAssignee => {
|
||||
return {
|
||||
login: assignee
|
||||
};
|
||||
}
|
||||
)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1112,14 +1112,12 @@ class IssuesProcessorBuilder {
|
|||
|
||||
issues(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this.issuesOrPrs(
|
||||
issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
issues.map((issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
return {
|
||||
...issue,
|
||||
pull_request: null
|
||||
};
|
||||
}
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
return this;
|
||||
|
@ -1127,14 +1125,12 @@ class IssuesProcessorBuilder {
|
|||
|
||||
prs(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this.issuesOrPrs(
|
||||
issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
issues.map((issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
return {
|
||||
...issue,
|
||||
pull_request: {key: 'value'}
|
||||
};
|
||||
}
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
return this;
|
||||
|
|
|
@ -188,8 +188,7 @@ class SUT {
|
|||
}
|
||||
|
||||
private _setTestIssueList(): SUT {
|
||||
this._testIssueList = this._sutIssues.map(
|
||||
(sutIssue: SUTIssue): Issue => {
|
||||
this._testIssueList = this._sutIssues.map((sutIssue: SUTIssue): Issue => {
|
||||
return generateIssue(
|
||||
this._opts,
|
||||
1,
|
||||
|
@ -198,8 +197,7 @@ class SUT {
|
|||
sutIssue.updatedAt,
|
||||
false
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -464,14 +464,12 @@ class IssuesProcessorBuilder {
|
|||
|
||||
issues(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this.issuesOrPrs(
|
||||
issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
issues.map((issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
return {
|
||||
...issue,
|
||||
pull_request: null
|
||||
};
|
||||
}
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
return this;
|
||||
|
@ -479,27 +477,23 @@ class IssuesProcessorBuilder {
|
|||
|
||||
staleIssues(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this.issues(
|
||||
issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
issues.map((issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
return {
|
||||
...issue,
|
||||
updated_at: '2020-01-01T17:00:00Z',
|
||||
created_at: '2020-01-01T17:00:00Z',
|
||||
labels: issue.labels?.map(
|
||||
(label: Readonly<ILabel>): ILabel => {
|
||||
labels: issue.labels?.map((label: Readonly<ILabel>): ILabel => {
|
||||
return {
|
||||
...label,
|
||||
name: 'Stale'
|
||||
};
|
||||
}
|
||||
) ?? [
|
||||
}) ?? [
|
||||
{
|
||||
name: 'Stale'
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
return this;
|
||||
|
@ -507,14 +501,12 @@ class IssuesProcessorBuilder {
|
|||
|
||||
prs(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this.issuesOrPrs(
|
||||
issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
issues.map((issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
return {
|
||||
...issue,
|
||||
pull_request: {key: 'value'}
|
||||
};
|
||||
}
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
return this;
|
||||
|
@ -522,27 +514,23 @@ class IssuesProcessorBuilder {
|
|||
|
||||
stalePrs(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this.prs(
|
||||
issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
issues.map((issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
return {
|
||||
...issue,
|
||||
updated_at: '2020-01-01T17:00:00Z',
|
||||
created_at: '2020-01-01T17:00:00Z',
|
||||
labels: issue.labels?.map(
|
||||
(label: Readonly<ILabel>): ILabel => {
|
||||
labels: issue.labels?.map((label: Readonly<ILabel>): ILabel => {
|
||||
return {
|
||||
...label,
|
||||
name: 'Stale'
|
||||
};
|
||||
}
|
||||
) ?? [
|
||||
}) ?? [
|
||||
{
|
||||
name: 'Stale'
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
return this;
|
||||
|
|
|
@ -286,7 +286,7 @@ class IssuesProcessor {
|
|||
return issue.isPullRequest ? option_1.Option.ClosePrLabel : option_1.Option.CloseIssueLabel;
|
||||
}
|
||||
processIssues(page = 1) {
|
||||
var _a, _b, _c;
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// get the next batch of issues
|
||||
const issues = yield this.getIssues(page);
|
||||
|
@ -305,7 +305,26 @@ class IssuesProcessor {
|
|||
break;
|
||||
}
|
||||
const issueLogger = new issue_logger_1.IssueLogger(issue);
|
||||
(_b = this._statistics) === null || _b === void 0 ? void 0 : _b.incrementProcessedItemsCount(issue);
|
||||
yield issueLogger.grouping(`$$type #${issue.number}`, () => __awaiter(this, void 0, void 0, function* () {
|
||||
yield this.processIssue(issue, actor);
|
||||
}));
|
||||
}
|
||||
if (!this.operations.hasRemainingOperations()) {
|
||||
this._logger.warning(logger_service_1.LoggerService.yellowBright(`No more operations left! Exiting...`));
|
||||
this._logger.warning(`${logger_service_1.LoggerService.yellowBright('If you think that not enough issues were processed you could try to increase the quantity related to the')} ${this._logger.createOptionLink(option_1.Option.OperationsPerRun)} ${logger_service_1.LoggerService.yellowBright('option which is currently set to')} ${logger_service_1.LoggerService.cyan(this.options.operationsPerRun)}`);
|
||||
(_b = this._statistics) === null || _b === void 0 ? void 0 : _b.setOperationsCount(this.operations.getConsumedOperationsCount()).logStats();
|
||||
return 0;
|
||||
}
|
||||
this._logger.info(`${logger_service_1.LoggerService.green('Batch')} ${logger_service_1.LoggerService.cyan(`#${page}`)} ${logger_service_1.LoggerService.green('processed.')}`);
|
||||
// Do the next batch
|
||||
return this.processIssues(page + 1);
|
||||
});
|
||||
}
|
||||
processIssue(issue, actor) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.incrementProcessedItemsCount(issue);
|
||||
const issueLogger = new issue_logger_1.IssueLogger(issue);
|
||||
issueLogger.info(`Found this $$type last updated at: ${logger_service_1.LoggerService.cyan(issue.updated_at)}`);
|
||||
// calculate string based messages for this issue
|
||||
const staleMessage = issue.isPullRequest
|
||||
|
@ -335,7 +354,7 @@ class IssuesProcessor {
|
|||
if (!hasAllWhitelistedLabels) {
|
||||
issueLogger.info(logger_service_1.LoggerService.white('└──'), `Skipping this $$type because it doesn't have all the required labels`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process issues without all of the required labels
|
||||
return; // Don't process issues without all of the required labels
|
||||
}
|
||||
else {
|
||||
issueLogger.info(logger_service_1.LoggerService.white('├──'), `All the required labels are present on this $$type`);
|
||||
|
@ -351,12 +370,12 @@ class IssuesProcessor {
|
|||
if (issue.state === 'closed') {
|
||||
issueLogger.info(`Skipping this $$type because it is closed`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process closed issues
|
||||
return; // Don't process closed issues
|
||||
}
|
||||
if (issue.locked) {
|
||||
issueLogger.info(`Skipping this $$type because it is locked`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process locked issues
|
||||
return; // Don't process locked issues
|
||||
}
|
||||
// Try to remove the close label when not close/locked issue or PR
|
||||
yield this._removeCloseLabel(issue, closeLabel);
|
||||
|
@ -374,7 +393,7 @@ class IssuesProcessor {
|
|||
if (!is_date_more_recent_than_1.isDateMoreRecentThan(createdAt, startDate)) {
|
||||
issueLogger.info(`Skipping this $$type because it was created before the specified start date`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process issues which were created before the start date
|
||||
return; // Don't process issues which were created before the start date
|
||||
}
|
||||
}
|
||||
if (issue.isStale) {
|
||||
|
@ -393,7 +412,7 @@ class IssuesProcessor {
|
|||
}
|
||||
issueLogger.info(`Skipping this $$type because it has an exempt label`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process exempt issues
|
||||
return; // Don't process exempt issues
|
||||
}
|
||||
const anyOfLabels = words_to_list_1.wordsToList(this._getAnyOfLabels(issue));
|
||||
if (anyOfLabels.length > 0) {
|
||||
|
@ -404,7 +423,7 @@ class IssuesProcessor {
|
|||
if (!hasOneOfWhitelistedLabels) {
|
||||
issueLogger.info(logger_service_1.LoggerService.white('└──'), `Skipping this $$type because it doesn't have one of the required labels`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process issues without any of the required labels
|
||||
return; // Don't process issues without any of the required labels
|
||||
}
|
||||
else {
|
||||
issueLogger.info(logger_service_1.LoggerService.white('├──'), `One of the required labels is present on this $$type`);
|
||||
|
@ -418,12 +437,12 @@ class IssuesProcessor {
|
|||
const milestones = new milestones_1.Milestones(this.options, issue);
|
||||
if (milestones.shouldExemptMilestones()) {
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process exempt milestones
|
||||
return; // Don't process exempt milestones
|
||||
}
|
||||
const assignees = new assignees_1.Assignees(this.options, issue);
|
||||
if (assignees.shouldExemptAssignees()) {
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process exempt assignees
|
||||
return; // Don't process exempt assignees
|
||||
}
|
||||
// Should this issue be marked stale?
|
||||
const shouldBeStale = !IssuesProcessor._updatedSince(issue.updated_at, daysBeforeStale);
|
||||
|
@ -453,16 +472,6 @@ class IssuesProcessor {
|
|||
yield this._processStaleIssue(issue, staleLabel, actor, closeMessage, closeLabel);
|
||||
}
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
}
|
||||
if (!this.operations.hasRemainingOperations()) {
|
||||
this._logger.warning(logger_service_1.LoggerService.yellowBright(`No more operations left! Exiting...`));
|
||||
this._logger.warning(`${logger_service_1.LoggerService.yellowBright('If you think that not enough issues were processed you could try to increase the quantity related to the')} ${this._logger.createOptionLink(option_1.Option.OperationsPerRun)} ${logger_service_1.LoggerService.yellowBright('option which is currently set to')} ${logger_service_1.LoggerService.cyan(this.options.operationsPerRun)}`);
|
||||
(_c = this._statistics) === null || _c === void 0 ? void 0 : _c.setOperationsCount(this.operations.getConsumedOperationsCount()).logStats();
|
||||
return 0;
|
||||
}
|
||||
this._logger.info(`${logger_service_1.LoggerService.green('Batch')} ${logger_service_1.LoggerService.cyan(`#${page}`)} ${logger_service_1.LoggerService.green('processed.')}`);
|
||||
// Do the next batch
|
||||
return this.processIssues(page + 1);
|
||||
});
|
||||
}
|
||||
// Grab comments for an issue since a given date
|
||||
|
@ -913,10 +922,19 @@ exports.IssuesProcessor = IssuesProcessor;
|
|||
/***/ }),
|
||||
|
||||
/***/ 2984:
|
||||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.IssueLogger = void 0;
|
||||
const logger_1 = __nccwpck_require__(6212);
|
||||
|
@ -948,6 +966,14 @@ class IssueLogger extends logger_1.Logger {
|
|||
error(...message) {
|
||||
super.error(this._format(...message));
|
||||
}
|
||||
grouping(message, fn) {
|
||||
const _super = Object.create(null, {
|
||||
grouping: { get: () => super.grouping }
|
||||
});
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return _super.grouping.call(this, this._format(message), fn);
|
||||
});
|
||||
}
|
||||
_replaceTokens(message) {
|
||||
return this._replaceTypeToken(message);
|
||||
}
|
||||
|
@ -1006,6 +1032,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
@ -1024,6 +1059,11 @@ class Logger {
|
|||
error(...message) {
|
||||
core.error(logger_service_1.LoggerService.whiteBright(message.join(' ')));
|
||||
}
|
||||
grouping(message, fn) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return core.group(logger_service_1.LoggerService.whiteBright(message), fn);
|
||||
});
|
||||
}
|
||||
createLink(name, link) {
|
||||
return terminal_link_1.default(name, link);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
"node",
|
||||
"stale"
|
||||
],
|
||||
"engines": {
|
||||
"node": "12",
|
||||
"npm": "6"
|
||||
},
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
|
@ -37,7 +37,8 @@ export class IssuesProcessor {
|
|||
}
|
||||
|
||||
private static _endIssueProcessing(issue: Issue): void {
|
||||
const consumedOperationsCount: number = issue.operations.getConsumedOperationsCount();
|
||||
const consumedOperationsCount: number =
|
||||
issue.operations.getConsumedOperationsCount();
|
||||
|
||||
if (consumedOperationsCount > 0) {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
@ -133,8 +134,45 @@ export class IssuesProcessor {
|
|||
}
|
||||
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
await issueLogger.grouping(`$$type #${issue.number}`, async () => {
|
||||
await this.processIssue(issue, actor);
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.operations.hasRemainingOperations()) {
|
||||
this._logger.warning(
|
||||
LoggerService.yellowBright(`No more operations left! Exiting...`)
|
||||
);
|
||||
this._logger.warning(
|
||||
`${LoggerService.yellowBright(
|
||||
'If you think that not enough issues were processed you could try to increase the quantity related to the'
|
||||
)} ${this._logger.createOptionLink(
|
||||
Option.OperationsPerRun
|
||||
)} ${LoggerService.yellowBright(
|
||||
'option which is currently set to'
|
||||
)} ${LoggerService.cyan(this.options.operationsPerRun)}`
|
||||
);
|
||||
this._statistics
|
||||
?.setOperationsCount(this.operations.getConsumedOperationsCount())
|
||||
.logStats();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
this._logger.info(
|
||||
`${LoggerService.green('Batch')} ${LoggerService.cyan(
|
||||
`#${page}`
|
||||
)} ${LoggerService.green('processed.')}`
|
||||
);
|
||||
|
||||
// Do the next batch
|
||||
return this.processIssues(page + 1);
|
||||
}
|
||||
|
||||
async processIssue(issue: Issue, actor: string): Promise<void> {
|
||||
this._statistics?.incrementProcessedItemsCount(issue);
|
||||
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
issueLogger.info(
|
||||
`Found this $$type last updated at: ${LoggerService.cyan(
|
||||
issue.updated_at
|
||||
|
@ -184,7 +222,7 @@ export class IssuesProcessor {
|
|||
);
|
||||
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process issues without all of the required labels
|
||||
return; // Don't process issues without all of the required labels
|
||||
} else {
|
||||
issueLogger.info(
|
||||
LoggerService.white('├──'),
|
||||
|
@ -216,13 +254,13 @@ export class IssuesProcessor {
|
|||
if (issue.state === 'closed') {
|
||||
issueLogger.info(`Skipping this $$type because it is closed`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process closed issues
|
||||
return; // Don't process closed issues
|
||||
}
|
||||
|
||||
if (issue.locked) {
|
||||
issueLogger.info(`Skipping this $$type because it is locked`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process locked issues
|
||||
return; // Don't process locked issues
|
||||
}
|
||||
|
||||
// Try to remove the close label when not close/locked issue or PR
|
||||
|
@ -243,9 +281,7 @@ export class IssuesProcessor {
|
|||
if (!isValidDate(createdAt)) {
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
core.setFailed(
|
||||
new Error(
|
||||
`Invalid issue field: "created_at". Expected a valid date`
|
||||
)
|
||||
new Error(`Invalid issue field: "created_at". Expected a valid date`)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -261,7 +297,7 @@ export class IssuesProcessor {
|
|||
);
|
||||
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process issues which were created before the start date
|
||||
return; // Don't process issues which were created before the start date
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -289,7 +325,7 @@ export class IssuesProcessor {
|
|||
|
||||
issueLogger.info(`Skipping this $$type because it has an exempt label`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process exempt issues
|
||||
return; // Don't process exempt issues
|
||||
}
|
||||
|
||||
const anyOfLabels: string[] = wordsToList(this._getAnyOfLabels(issue));
|
||||
|
@ -315,7 +351,7 @@ export class IssuesProcessor {
|
|||
`Skipping this $$type because it doesn't have one of the required labels`
|
||||
);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process issues without any of the required labels
|
||||
return; // Don't process issues without any of the required labels
|
||||
} else {
|
||||
issueLogger.info(
|
||||
LoggerService.white('├──'),
|
||||
|
@ -342,14 +378,14 @@ export class IssuesProcessor {
|
|||
|
||||
if (milestones.shouldExemptMilestones()) {
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process exempt milestones
|
||||
return; // Don't process exempt milestones
|
||||
}
|
||||
|
||||
const assignees: Assignees = new Assignees(this.options, issue);
|
||||
|
||||
if (assignees.shouldExemptAssignees()) {
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process exempt assignees
|
||||
return; // Don't process exempt assignees
|
||||
}
|
||||
|
||||
// Should this issue be marked stale?
|
||||
|
@ -410,36 +446,6 @@ export class IssuesProcessor {
|
|||
IssuesProcessor._endIssueProcessing(issue);
|
||||
}
|
||||
|
||||
if (!this.operations.hasRemainingOperations()) {
|
||||
this._logger.warning(
|
||||
LoggerService.yellowBright(`No more operations left! Exiting...`)
|
||||
);
|
||||
this._logger.warning(
|
||||
`${LoggerService.yellowBright(
|
||||
'If you think that not enough issues were processed you could try to increase the quantity related to the'
|
||||
)} ${this._logger.createOptionLink(
|
||||
Option.OperationsPerRun
|
||||
)} ${LoggerService.yellowBright(
|
||||
'option which is currently set to'
|
||||
)} ${LoggerService.cyan(this.options.operationsPerRun)}`
|
||||
);
|
||||
this._statistics
|
||||
?.setOperationsCount(this.operations.getConsumedOperationsCount())
|
||||
.logStats();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
this._logger.info(
|
||||
`${LoggerService.green('Batch')} ${LoggerService.cyan(
|
||||
`#${page}`
|
||||
)} ${LoggerService.green('processed.')}`
|
||||
);
|
||||
|
||||
// Do the next batch
|
||||
return this.processIssues(page + 1);
|
||||
}
|
||||
|
||||
// Grab comments for an issue since a given date
|
||||
async listIssueComments(
|
||||
issueNumber: Readonly<number>,
|
||||
|
@ -484,16 +490,15 @@ export class IssuesProcessor {
|
|||
|
||||
try {
|
||||
this.operations.consumeOperation();
|
||||
const issueResult: OctoKitIssueList = await this.client.issues.listForRepo(
|
||||
{
|
||||
const issueResult: OctoKitIssueList =
|
||||
await this.client.issues.listForRepo({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
state: 'open',
|
||||
per_page: 100,
|
||||
direction: this.options.ascending ? 'asc' : 'desc',
|
||||
page
|
||||
}
|
||||
);
|
||||
});
|
||||
this._statistics?.incrementFetchedItemsCount(issueResult.data.length);
|
||||
|
||||
return issueResult.data.map(
|
||||
|
@ -579,9 +584,8 @@ export class IssuesProcessor {
|
|||
`$$type has been updated: ${LoggerService.cyan(issueHasUpdate)}`
|
||||
);
|
||||
|
||||
const shouldRemoveStaleWhenUpdated: boolean = this._shouldRemoveStaleWhenUpdated(
|
||||
issue
|
||||
);
|
||||
const shouldRemoveStaleWhenUpdated: boolean =
|
||||
this._shouldRemoveStaleWhenUpdated(issue);
|
||||
|
||||
issueLogger.info(
|
||||
`The option ${issueLogger.createOptionLink(
|
||||
|
|
|
@ -35,6 +35,10 @@ export class IssueLogger extends Logger {
|
|||
super.error(this._format(...message));
|
||||
}
|
||||
|
||||
async grouping(message: string, fn: () => Promise<void>): Promise<void> {
|
||||
return super.grouping(this._format(message), fn);
|
||||
}
|
||||
|
||||
private _replaceTokens(message: Readonly<string>): string {
|
||||
return this._replaceTypeToken(message);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,10 @@ export class Logger {
|
|||
core.error(LoggerService.whiteBright(message.join(' ')));
|
||||
}
|
||||
|
||||
async grouping(message: string, fn: () => Promise<void>): Promise<void> {
|
||||
return core.group(LoggerService.whiteBright(message), fn);
|
||||
}
|
||||
|
||||
createLink(name: Readonly<string>, link: Readonly<string>): string {
|
||||
return terminalLink(name, link);
|
||||
}
|
||||
|
|
|
@ -195,9 +195,8 @@ export class Milestones {
|
|||
return false;
|
||||
}
|
||||
|
||||
const cleanMilestone: CleanMilestone = Milestones._cleanMilestone(
|
||||
milestone
|
||||
);
|
||||
const cleanMilestone: CleanMilestone =
|
||||
Milestones._cleanMilestone(milestone);
|
||||
|
||||
const isSameMilestone: boolean =
|
||||
cleanMilestone ===
|
||||
|
|
|
@ -7,9 +7,9 @@ describe('isLabeled()', (): void => {
|
|||
|
||||
describe('when the given issue contains no label', (): void => {
|
||||
beforeEach((): void => {
|
||||
issue = ({
|
||||
issue = {
|
||||
labels: []
|
||||
} as unknown) as Issue;
|
||||
} as unknown as Issue;
|
||||
});
|
||||
|
||||
describe('when the given label is a simple label', (): void => {
|
||||
|
|
Loading…
Reference in New Issue