mirror of
https://github.com/actions/stale.git
synced 2025-12-11 04:32:53 +00:00
feat(statistics): split the stats between issues and PRs (#364)
* 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> * test: add more coverage for the stale label behaviour (#352) (#17) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * test(refactor): use toHaveLength * feat(statistics): split the processed issues and prs * feat(statistics): split the new stale issues and prs * feat(statistics): split the no longer stale issues and prs * chore(deps): undo upgrade of dependencies * feat(statistics): split closed issues and prs * feat(statistics): use the word "items" when something concern both issues and prs * feat(statistics): split more stats by issues and prs * feat(statistics): split more stats by issues and prs (final) * chore(index): update it Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
10eec4583b
commit
5e20aa8410
@@ -94,7 +94,7 @@ export class IssuesProcessor {
|
||||
|
||||
for (const issue of issues.values()) {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
this._statistics?.incrementProcessedIssuesCount();
|
||||
this._statistics?.incrementProcessedItemsCount(issue);
|
||||
|
||||
issueLogger.info(`Found this $$type last updated ${issue.updated_at}`);
|
||||
|
||||
@@ -320,7 +320,7 @@ export class IssuesProcessor {
|
||||
// find any comments since date on the given issue
|
||||
try {
|
||||
this._operations.consumeOperation();
|
||||
this._statistics?.incrementFetchedIssuesCommentsCount();
|
||||
this._statistics?.incrementFetchedItemsCommentsCount();
|
||||
const comments = await this.client.issues.listComments({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
@@ -366,7 +366,7 @@ export class IssuesProcessor {
|
||||
page
|
||||
}
|
||||
);
|
||||
this._statistics?.incrementFetchedIssuesCount(issueResult.data.length);
|
||||
this._statistics?.incrementFetchedItemsCount(issueResult.data.length);
|
||||
|
||||
return issueResult.data.map(
|
||||
(issue: Readonly<IIssue>): Issue => new Issue(this.options, issue)
|
||||
@@ -388,7 +388,7 @@ export class IssuesProcessor {
|
||||
issueLogger.info(`Checking for label on $$type`);
|
||||
|
||||
this._operations.consumeOperation();
|
||||
this._statistics?.incrementFetchedIssuesEventsCount();
|
||||
this._statistics?.incrementFetchedItemsEventsCount();
|
||||
const options = this.client.issues.listEvents.endpoint.merge({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
@@ -526,7 +526,7 @@ export class IssuesProcessor {
|
||||
if (!skipMessage) {
|
||||
try {
|
||||
this._operations.consumeOperation();
|
||||
this._statistics?.incrementAddedComment();
|
||||
this._statistics?.incrementAddedItemsComment(issue);
|
||||
await this.client.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
@@ -540,8 +540,8 @@ export class IssuesProcessor {
|
||||
|
||||
try {
|
||||
this._operations.consumeOperation();
|
||||
this._statistics?.incrementAddedLabel();
|
||||
this._statistics?.incrementStaleIssuesCount();
|
||||
this._statistics?.incrementAddedItemsLabel(issue);
|
||||
this._statistics?.incrementStaleItemsCount(issue);
|
||||
await this.client.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
@@ -571,7 +571,7 @@ export class IssuesProcessor {
|
||||
if (closeMessage) {
|
||||
try {
|
||||
this._operations.consumeOperation();
|
||||
this._statistics?.incrementAddedComment();
|
||||
this._statistics?.incrementAddedItemsComment(issue);
|
||||
await this.client.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
@@ -586,7 +586,7 @@ export class IssuesProcessor {
|
||||
if (closeLabel) {
|
||||
try {
|
||||
this._operations.consumeOperation();
|
||||
this._statistics?.incrementAddedLabel();
|
||||
this._statistics?.incrementAddedItemsLabel(issue);
|
||||
await this.client.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
@@ -600,7 +600,7 @@ export class IssuesProcessor {
|
||||
|
||||
try {
|
||||
this._operations.consumeOperation();
|
||||
this._statistics?.incrementClosedIssuesCount();
|
||||
this._statistics?.incrementClosedItemsCount(issue);
|
||||
await this.client.issues.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
@@ -673,7 +673,7 @@ export class IssuesProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove a label from an issue
|
||||
// Remove a label from an issue or a pull request
|
||||
private async _removeLabel(issue: Issue, label: string): Promise<void> {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
@@ -686,7 +686,7 @@ export class IssuesProcessor {
|
||||
|
||||
try {
|
||||
this._operations.consumeOperation();
|
||||
this._statistics?.incrementDeletedLabelsCount();
|
||||
this._statistics?.incrementDeletedItemsLabelsCount(issue);
|
||||
await this.client.issues.removeLabel({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
@@ -747,7 +747,7 @@ export class IssuesProcessor {
|
||||
);
|
||||
|
||||
await this._removeLabel(issue, staleLabel);
|
||||
this._statistics?.incrementUndoStaleIssuesCount();
|
||||
this._statistics?.incrementUndoStaleItemsCount(issue);
|
||||
}
|
||||
|
||||
private async _removeCloseLabel(
|
||||
@@ -772,7 +772,7 @@ export class IssuesProcessor {
|
||||
);
|
||||
|
||||
await this._removeLabel(issue, closeLabel);
|
||||
this._statistics?.incrementDeletedCloseLabelsCount();
|
||||
this._statistics?.incrementDeletedCloseItemsLabelsCount(issue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user