From c9d32d2c231a7f13083f6b0096f284f70415b36d Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Fri, 11 Aug 2023 09:08:24 -0400 Subject: [PATCH 1/3] Fix logging for items transitioning to stale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The issue that the stale action finds in this log excerpt *is* stale, it just isn't marked that way yet. Saying that the issue isn't stale is misleading and contradictory. https://github.com/jsoref/stale-bot-debug/actions/runs/5828506506/job/15806335430#step:2:97 ::group::[#2] Issue #2 [#2] Issue #2 [#2] Found this issue last updated at: 2023-08-09T14:33:12Z ... [#2] This issue is not stale ... [#2] This issue should be stale based on the last update date the 09-08-2023 (2023-08-09T14:33:12Z) [#2] This issue should be marked as stale based on the option days-before-issue-stale (​https://github.com/actions/stale#days-before-issue-stale​) (1) [#2] Marking this issue as stale --- dist/index.js | 2 +- src/classes/issues-processor.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 343c8313a..441592e2d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -603,7 +603,7 @@ class IssuesProcessor { } // Determine if this issue needs to be marked stale first if (!issue.isStale) { - issueLogger.info(`This $$type is not stale`); + issueLogger.info(`This $$type is not marked stale`); const shouldIgnoreUpdates = new ignore_updates_1.IgnoreUpdates(this.options, issue).shouldIgnoreUpdates(); // Should this issue be marked as stale? let shouldBeStale; diff --git a/src/classes/issues-processor.ts b/src/classes/issues-processor.ts index 31bbb99d6..71a0d0035 100644 --- a/src/classes/issues-processor.ts +++ b/src/classes/issues-processor.ts @@ -446,7 +446,7 @@ export class IssuesProcessor { // Determine if this issue needs to be marked stale first if (!issue.isStale) { - issueLogger.info(`This $$type is not stale`); + issueLogger.info(`This $$type is not marked stale`); const shouldIgnoreUpdates: boolean = new IgnoreUpdates( this.options, From deab8514c26a930157c256da6a164801385267ed Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Fri, 11 Aug 2023 09:16:14 -0400 Subject: [PATCH 2/3] Fix logging for removing nonexistent label MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/jsoref/stale-bot-debug/actions/runs/5828506506/job/15806335430#step:2:97 ::group::[#2] Issue #2 [#2] Issue #2 ... [#2] Removing all the labels specified via the labels-to-remove-when-stale (​https://github.com/actions/stale#labels-to-remove-when-stale​) option. [#2] Removing the label "label-to-add-when-unstale" from this issue... Error: [#2] Error when removing the label: "Label does not exist" The quotes on this last line make it look like the action was trying to remove a label named `Label does not exist`. This change removes the quotes to make it clear that the text is just an error message (which is implied by the `:`) as opposed to the name of a label, which is the reading one gets from the inclusion of additional quotes around the text. --- dist/index.js | 2 +- src/classes/issues-processor.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 441592e2d..ab1b84c33 100644 --- a/dist/index.js +++ b/dist/index.js @@ -998,7 +998,7 @@ class IssuesProcessor { issueLogger.info(`${isSubStep ? logger_service_1.LoggerService.white('└── ') : ''}The label "${logger_service_1.LoggerService.cyan(label)}" was removed`); } catch (error) { - issueLogger.error(`${isSubStep ? logger_service_1.LoggerService.white('└── ') : ''}Error when removing the label: "${logger_service_1.LoggerService.cyan(error.message)}"`); + issueLogger.error(`${isSubStep ? logger_service_1.LoggerService.white('└── ') : ''}Error when removing the label: ${logger_service_1.LoggerService.cyan(error.message)}`); } }); } diff --git a/src/classes/issues-processor.ts b/src/classes/issues-processor.ts index 71a0d0035..8858b7189 100644 --- a/src/classes/issues-processor.ts +++ b/src/classes/issues-processor.ts @@ -1039,7 +1039,7 @@ export class IssuesProcessor { issueLogger.error( `${ isSubStep ? LoggerService.white('└── ') : '' - }Error when removing the label: "${LoggerService.cyan(error.message)}"` + }Error when removing the label: ${LoggerService.cyan(error.message)}` ); } } From 0e933d6760635bea076d3080f36d46bb0a0b23f9 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Fri, 11 Aug 2023 09:20:01 -0400 Subject: [PATCH 3/3] Fix logging because not all items are issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/jsoref/stale-bot-debug/actions/runs/5828506506/job/15806335430#step:2:56 Processing the batch of issues #1 containing 3 issues... ::group::[#3] Pull request #3 [#3] Pull request #3 ... ::group::[#2] Issue #2 [#2] Issue #2 ... ::group::[#1] Issue #1 [#1] Issue #1 ... Batch #1 processed. No more issues found to process. Exiting... Statistics: Processed items: 3 ├── Processed issues: 2 └── Processed PRs : 1 Clearly this action sometimes understands that users do not view all items as issues. This change applies the `items` nomenclature to this initial logging. --- dist/index.js | 12 ++++++------ src/classes/issues-processor.ts | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dist/index.js b/dist/index.js index ab1b84c33..29b63ad94 100644 --- a/dist/index.js +++ b/dist/index.js @@ -425,16 +425,16 @@ class IssuesProcessor { processIssues(page = 1) { var _a, _b; return __awaiter(this, void 0, void 0, function* () { - // get the next batch of issues + // get the next batch of items const issues = yield this.getIssues(page); if (issues.length <= 0) { - this._logger.info(logger_service_1.LoggerService.green(`No more issues found to process. Exiting...`)); + this._logger.info(logger_service_1.LoggerService.green(`No more items found to process. Exiting...`)); (_a = this.statistics) === null || _a === void 0 ? void 0 : _a.setOperationsCount(this.operations.getConsumedOperationsCount()).logStats(); this.state.reset(); 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' : ''}...`)}`); + this._logger.info(`${logger_service_1.LoggerService.yellow('Processing the batch of items ')} ${logger_service_1.LoggerService.cyan(`#${page}`)} ${logger_service_1.LoggerService.yellow(' containing ')} ${logger_service_1.LoggerService.cyan(issues.length)} ${logger_service_1.LoggerService.yellow(` item${issues.length > 1 ? 's' : ''}...`)}`); } const labelsToRemoveWhenStale = (0, words_to_list_1.wordsToList)(this.options.labelsToRemoveWhenStale); const labelsToAddWhenUnstale = (0, words_to_list_1.wordsToList)(this.options.labelsToAddWhenUnstale); @@ -456,7 +456,7 @@ class IssuesProcessor { } 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)}`); + this._logger.warning(`${logger_service_1.LoggerService.yellowBright('If you think that not enough items 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; } @@ -667,7 +667,7 @@ class IssuesProcessor { return comments.data; } catch (error) { - this._logger.error(`List issue comments error: ${error.message}`); + this._logger.error(`List $$type comments error: ${error.message}`); return Promise.resolve([]); } }); @@ -690,7 +690,7 @@ class IssuesProcessor { return issueResult.data.map((issue) => new issue_1.Issue(this.options, issue)); } catch (error) { - throw Error(`Getting issues was blocked by the error: ${error.message}`); + throw Error(`Getting items was blocked by the error: ${error.message}`); } }); } diff --git a/src/classes/issues-processor.ts b/src/classes/issues-processor.ts index 8858b7189..b41488765 100644 --- a/src/classes/issues-processor.ts +++ b/src/classes/issues-processor.ts @@ -104,12 +104,12 @@ export class IssuesProcessor { } async processIssues(page: Readonly = 1): Promise { - // get the next batch of issues + // get the next batch of items const issues: Issue[] = await this.getIssues(page); if (issues.length <= 0) { this._logger.info( - LoggerService.green(`No more issues found to process. Exiting...`) + LoggerService.green(`No more items found to process. Exiting...`) ); this.statistics ?.setOperationsCount(this.operations.getConsumedOperationsCount()) @@ -121,11 +121,11 @@ export class IssuesProcessor { } else { this._logger.info( `${LoggerService.yellow( - 'Processing the batch of issues ' + 'Processing the batch of items ' )} ${LoggerService.cyan(`#${page}`)} ${LoggerService.yellow( ' containing ' )} ${LoggerService.cyan(issues.length)} ${LoggerService.yellow( - ` issue${issues.length > 1 ? 's' : ''}...` + ` item${issues.length > 1 ? 's' : ''}...` )}` ); } @@ -171,7 +171,7 @@ export class IssuesProcessor { ); this._logger.warning( `${LoggerService.yellowBright( - 'If you think that not enough issues were processed you could try to increase the quantity related to the ' + 'If you think that not enough items were processed you could try to increase the quantity related to the ' )} ${this._logger.createOptionLink( Option.OperationsPerRun )} ${LoggerService.yellowBright( @@ -555,7 +555,7 @@ export class IssuesProcessor { }); return comments.data; } catch (error) { - this._logger.error(`List issue comments error: ${error.message}`); + this._logger.error(`List $$type comments error: ${error.message}`); return Promise.resolve([]); } } @@ -579,7 +579,7 @@ export class IssuesProcessor { new Issue(this.options, issue as Readonly) ); } catch (error) { - throw Error(`Getting issues was blocked by the error: ${error.message}`); + throw Error(`Getting items was blocked by the error: ${error.message}`); } }