Fix logging because not all items are issues

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.
This commit is contained in:
Josh Soref 2023-08-11 09:20:01 -04:00
parent deab8514c2
commit 0e933d6760
2 changed files with 13 additions and 13 deletions

12
dist/index.js vendored
View File

@ -425,16 +425,16 @@ class IssuesProcessor {
processIssues(page = 1) { processIssues(page = 1) {
var _a, _b; var _a, _b;
return __awaiter(this, void 0, void 0, function* () { 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); const issues = yield this.getIssues(page);
if (issues.length <= 0) { 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(); (_a = this.statistics) === null || _a === void 0 ? void 0 : _a.setOperationsCount(this.operations.getConsumedOperationsCount()).logStats();
this.state.reset(); this.state.reset();
return this.operations.getRemainingOperationsCount(); return this.operations.getRemainingOperationsCount();
} }
else { 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 labelsToRemoveWhenStale = (0, words_to_list_1.wordsToList)(this.options.labelsToRemoveWhenStale);
const labelsToAddWhenUnstale = (0, words_to_list_1.wordsToList)(this.options.labelsToAddWhenUnstale); const labelsToAddWhenUnstale = (0, words_to_list_1.wordsToList)(this.options.labelsToAddWhenUnstale);
@ -456,7 +456,7 @@ class IssuesProcessor {
} }
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(`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(); (_b = this.statistics) === null || _b === void 0 ? void 0 : _b.setOperationsCount(this.operations.getConsumedOperationsCount()).logStats();
return 0; return 0;
} }
@ -667,7 +667,7 @@ class IssuesProcessor {
return comments.data; return comments.data;
} }
catch (error) { catch (error) {
this._logger.error(`List issue comments error: ${error.message}`); this._logger.error(`List $$type comments error: ${error.message}`);
return Promise.resolve([]); return Promise.resolve([]);
} }
}); });
@ -690,7 +690,7 @@ class IssuesProcessor {
return issueResult.data.map((issue) => new issue_1.Issue(this.options, issue)); return issueResult.data.map((issue) => new issue_1.Issue(this.options, issue));
} }
catch (error) { catch (error) {
throw Error(`Getting issues was blocked by the error: ${error.message}`); throw Error(`Getting items was blocked by the error: ${error.message}`);
} }
}); });
} }

View File

@ -104,12 +104,12 @@ export class IssuesProcessor {
} }
async processIssues(page: Readonly<number> = 1): Promise<number> { async processIssues(page: Readonly<number> = 1): Promise<number> {
// get the next batch of issues // get the next batch of items
const issues: Issue[] = await this.getIssues(page); const issues: Issue[] = await this.getIssues(page);
if (issues.length <= 0) { if (issues.length <= 0) {
this._logger.info( this._logger.info(
LoggerService.green(`No more issues found to process. Exiting...`) LoggerService.green(`No more items found to process. Exiting...`)
); );
this.statistics this.statistics
?.setOperationsCount(this.operations.getConsumedOperationsCount()) ?.setOperationsCount(this.operations.getConsumedOperationsCount())
@ -121,11 +121,11 @@ export class IssuesProcessor {
} else { } else {
this._logger.info( this._logger.info(
`${LoggerService.yellow( `${LoggerService.yellow(
'Processing the batch of issues ' 'Processing the batch of items '
)} ${LoggerService.cyan(`#${page}`)} ${LoggerService.yellow( )} ${LoggerService.cyan(`#${page}`)} ${LoggerService.yellow(
' containing ' ' containing '
)} ${LoggerService.cyan(issues.length)} ${LoggerService.yellow( )} ${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( this._logger.warning(
`${LoggerService.yellowBright( `${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( )} ${this._logger.createOptionLink(
Option.OperationsPerRun Option.OperationsPerRun
)} ${LoggerService.yellowBright( )} ${LoggerService.yellowBright(
@ -555,7 +555,7 @@ export class IssuesProcessor {
}); });
return comments.data; return comments.data;
} catch (error) { } catch (error) {
this._logger.error(`List issue comments error: ${error.message}`); this._logger.error(`List $$type comments error: ${error.message}`);
return Promise.resolve([]); return Promise.resolve([]);
} }
} }
@ -579,7 +579,7 @@ export class IssuesProcessor {
new Issue(this.options, issue as Readonly<OctokitIssue>) new Issue(this.options, issue as Readonly<OctokitIssue>)
); );
} catch (error) { } catch (error) {
throw Error(`Getting issues was blocked by the error: ${error.message}`); throw Error(`Getting items was blocked by the error: ${error.message}`);
} }
} }