From ad17c4481c1c9764f7f96f28d20e9b84e2bebd50 Mon Sep 17 00:00:00 2001 From: TESTELIN Geoffrey Date: Wed, 2 Jun 2021 22:07:10 +0200 Subject: [PATCH] chore: update index --- dist/index.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/dist/index.js b/dist/index.js index 316ec729c..6bd3e5b9d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -258,7 +258,7 @@ class IssuesProcessor { this.removedLabelIssues = []; this.options = options; this.client = github_1.getOctokit(this.options.repoToken); - this._operations = new stale_operations_1.StaleOperations(this.options); + this.operations = new stale_operations_1.StaleOperations(this.options); this._logger.info(chalk_1.default.yellow('Starting the stale action process...')); if (this.options.debugOnly) { this._logger.warning(chalk_1.default.yellowBright('Executing in debug mode!')); @@ -286,22 +286,22 @@ class IssuesProcessor { : option_1.Option.StaleIssueMessage; } processIssues(page = 1) { - var _a, _b; + var _a, _b, _c; return __awaiter(this, void 0, void 0, function* () { // get the next batch of issues const issues = yield this.getIssues(page); const actor = yield this.getActor(); if (issues.length <= 0) { this._logger.info(chalk_1.default.green('No more issues found to process. Exiting...')); - (_a = this._statistics) === null || _a === void 0 ? void 0 : _a.setRemainingOperations(this._operations.getRemainingOperationsCount()).logStats(); - return this._operations.getRemainingOperationsCount(); + (_a = this._statistics) === null || _a === void 0 ? void 0 : _a.setOperationsCount(this.operations.getConsumedOperationsCount()).logStats(); + return this.operations.getRemainingOperationsCount(); } else { this._logger.info(chalk_1.default.yellow(`Processing the batch of issues ${chalk_1.default.cyan(`#${page}`)} containing ${chalk_1.default.cyan(issues.length)} issue${issues.length > 1 ? 's' : ''}...`)); } for (const issue of issues.values()) { // Stop the processing if no more operations remains - if (!this._operations.hasRemainingOperations()) { + if (!this.operations.hasRemainingOperations()) { break; } const issueLogger = new issue_logger_1.IssueLogger(issue); @@ -454,9 +454,10 @@ class IssuesProcessor { } IssuesProcessor._endIssueProcessing(issue); } - if (!this._operations.hasRemainingOperations()) { + if (!this.operations.hasRemainingOperations()) { this._logger.warning(chalk_1.default.yellowBright('No more operations left! Exiting...')); this._logger.warning(chalk_1.default.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)} option which is currently set to ${chalk_1.default.cyan(this.options.operationsPerRun)}`)); + (_c = this._statistics) === null || _c === void 0 ? void 0 : _c.setOperationsCount(this.operations.getConsumedOperationsCount()).logStats(); return 0; } this._logger.info(chalk_1.default.green(`Batch ${chalk_1.default.cyan(`#${page}`)} processed.`)); @@ -470,7 +471,7 @@ class IssuesProcessor { return __awaiter(this, void 0, void 0, function* () { // Find any comments since date on the given issue try { - this._operations.consumeOperation(); + this.operations.consumeOperation(); (_a = this._statistics) === null || _a === void 0 ? void 0 : _a.incrementFetchedItemsCommentsCount(); const comments = yield this.client.issues.listComments({ owner: github_1.context.repo.owner, @@ -491,7 +492,7 @@ class IssuesProcessor { return __awaiter(this, void 0, void 0, function* () { let actor; try { - this._operations.consumeOperation(); + this.operations.consumeOperation(); actor = yield this.client.users.getAuthenticated(); } catch (error) { @@ -507,7 +508,7 @@ class IssuesProcessor { // generate type for response const endpoint = this.client.issues.listForRepo; try { - this._operations.consumeOperation(); + this.operations.consumeOperation(); const issueResult = yield this.client.issues.listForRepo({ owner: github_1.context.repo.owner, repo: github_1.context.repo.repo, @@ -866,7 +867,7 @@ class IssuesProcessor { }); } _consumeIssueOperation(issue) { - this._operations.consumeOperation(); + this.operations.consumeOperation(); issue.operations.consumeOperation(); } _getDaysBeforeStaleUsedOptionName(issue) { @@ -1272,8 +1273,8 @@ class Statistics { } return this._incrementUndoStaleIssuesCount(increment); } - setRemainingOperations(remainingOperations) { - this._operationsCount = remainingOperations; + setOperationsCount(operationsCount) { + this._operationsCount = operationsCount; return this; } incrementClosedItemsCount(issue, increment = 1) {