mirror of
https://github.com/actions/stale.git
synced 2025-12-30 05:37:36 +08:00
chore(logs): enhance the logs (#358)
* docs(only-labels): enhance the docs and fix duplicate (#341) * docs(only-labels): remove duplicated option and improve descriptions a bad rebase happend * docs(readme): use a multi-line array and remove the optional column the option column was not helpful since each value is optional the multi-line array will allow to have a better UI in small devices and basically in GitHub too due to the max-width * style(readme): break line for the statistics * docs(readme): add a better description for the ascending option * docs(action): add missing punctuation * build(deps-dev): bump @typescript-eslint/eslint-plugin (#342) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.15.2 to 4.16.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.16.1/packages/eslint-plugin) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump @octokit/rest from 18.3.0 to 18.3.2 (#350) Bumps [@octokit/rest](https://github.com/octokit/rest.js) from 18.3.0 to 18.3.2. - [Release notes](https://github.com/octokit/rest.js/releases) - [Commits](https://github.com/octokit/rest.js/compare/v18.3.0...v18.3.2) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * test: add more coverage for the stale label behaviour (#352) (#15) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(logs): add logs for the milestones * chore(errors): use actions error instead of throw errors * chore(logs): enhance the logs and add some colors tl;dr: blue for values, megenta for options, white for messages, yellow light for warnings, yellow for milestones and green for success still a WIP but I wish to confirm this before continuing @hross is it ok for you? * chore(index): update the index * chore(ci): use npm ci instead of npm i * chore(logs): removed some useless logs * refactor(issues): remove useless check * chore(statistics): show the real count of fetched issues * refactor(operations): use a class to handle the operations left closes #361 * chore(logs): include the total number of issues in the log for a batch Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
3b3c3f03cd
commit
b717aa9f47
@@ -1,9 +1,8 @@
|
||||
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||
import chalk from 'chalk';
|
||||
import {Logger} from './loggers/logger';
|
||||
|
||||
export class Statistics {
|
||||
private readonly _logger: Logger = new Logger();
|
||||
private readonly _options: IIssuesProcessorOptions;
|
||||
private _processedIssuesCount = 0;
|
||||
private _staleIssuesCount = 0;
|
||||
private _undoStaleIssuesCount = 0;
|
||||
@@ -19,10 +18,6 @@ export class Statistics {
|
||||
private _fetchedIssuesCommentsCount = 0;
|
||||
private _fetchedPullRequestsCount = 0;
|
||||
|
||||
constructor(options: IIssuesProcessorOptions) {
|
||||
this._options = options;
|
||||
}
|
||||
|
||||
incrementProcessedIssuesCount(increment: Readonly<number> = 1): Statistics {
|
||||
this._processedIssuesCount += increment;
|
||||
|
||||
@@ -42,7 +37,7 @@ export class Statistics {
|
||||
}
|
||||
|
||||
setOperationsLeft(operationsLeft: Readonly<number>): Statistics {
|
||||
this._operationsCount = this._options.operationsPerRun - operationsLeft;
|
||||
this._operationsCount = operationsLeft;
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -116,7 +111,7 @@ export class Statistics {
|
||||
}
|
||||
|
||||
logStats(): Statistics {
|
||||
this._logger.info('Statistics');
|
||||
this._logger.info(chalk.yellow.bold('Statistics:'));
|
||||
this._logProcessedIssuesCount();
|
||||
this._logStaleIssuesCount();
|
||||
this._logUndoStaleIssuesCount();
|
||||
@@ -131,7 +126,6 @@ export class Statistics {
|
||||
this._logFetchedIssuesEventsCount();
|
||||
this._logFetchedIssuesCommentsCount();
|
||||
this._logFetchedPullRequestsCount();
|
||||
this._logger.info('---');
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -194,7 +188,7 @@ export class Statistics {
|
||||
|
||||
private _logCount(name: Readonly<string>, count: Readonly<number>): void {
|
||||
if (count > 0) {
|
||||
this._logger.info(`${name}: ${count}`);
|
||||
this._logger.info(`${name}:`, chalk.cyan(count));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user