From 2f93a2a49f4c195ae653bb1d88195f1ada50c8f7 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 f8e3376b9..40257c1ce 100644 --- a/dist/index.js +++ b/dist/index.js @@ -255,7 +255,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(logger_service_1.LoggerService.yellow(`Starting the stale action process...`)); if (this.options.debugOnly) { this._logger.warning(logger_service_1.LoggerService.yellowBright(`Executing in debug mode!`)); @@ -283,22 +283,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(logger_service_1.LoggerService.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(`${logger_service_1.LoggerService.yellow('Processing the batch of issues')} ${logger_service_1.LoggerService.cyan(`#${page}`)} ${logger_service_1.LoggerService.yellow('containing')} ${logger_service_1.LoggerService.cyan(issues.length)} ${logger_service_1.LoggerService.yellow(`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); @@ -451,9 +451,10 @@ class IssuesProcessor { } IssuesProcessor._endIssueProcessing(issue); } - if (!this._operations.hasRemainingOperations()) { + 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.')}`); @@ -467,7 +468,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, @@ -488,7 +489,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) { @@ -504,7 +505,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, @@ -863,7 +864,7 @@ class IssuesProcessor { }); } _consumeIssueOperation(issue) { - this._operations.consumeOperation(); + this.operations.consumeOperation(); issue.operations.consumeOperation(); } _getDaysBeforeStaleUsedOptionName(issue) { @@ -1263,8 +1264,8 @@ class Statistics { } return this._incrementUndoStaleIssuesCount(increment); } - setRemainingOperations(remainingOperations) { - this._operationsCount = remainingOperations; + setOperationsCount(operationsCount) { + this._operationsCount = operationsCount; return this; } incrementClosedItemsCount(issue, increment = 1) {