feat: remove the any-of-labels option

BREAKING CHANGE:
The option any-of-labels was removed
This commit is contained in:
TESTELIN Geoffrey 2021-10-08 20:18:01 +02:00
parent f6a70aa856
commit 1c81c38e2f
No known key found for this signature in database
GPG Key ID: 05D28E8D8E8E52DA
9 changed files with 562 additions and 1195 deletions

View File

@ -50,9 +50,8 @@ Every argument is optional.
| [only-labels](#only-labels) | Only issues/PRs with ALL these labels are checked | | | [only-labels](#only-labels) | Only issues/PRs with ALL these labels are checked | |
| [only-issue-labels](#only-issue-labels) | Override [only-labels](#only-labels) for issues only | | | [only-issue-labels](#only-issue-labels) | Override [only-labels](#only-labels) for issues only | |
| [only-pr-labels](#only-pr-labels) | Override [only-labels](#only-labels) for PRs only | | | [only-pr-labels](#only-pr-labels) | Override [only-labels](#only-labels) for PRs only | |
| [any-of-labels](#any-of-labels) | Only issues/PRs with ANY of these labels are checked | | | [any-of-issue-labels](#any-of-issue-labels) | Only issues with ANY of these labels are checked | |
| [any-of-issue-labels](#any-of-issue-labels) | Override [any-of-labels](#any-of-labels) for issues only | | | [any-of-pr-labels](#any-of-pr-labels) | Only PRs with ANY of these labels are checked | |
| [any-of-pr-labels](#any-of-pr-labels) | Override [any-of-labels](#any-of-labels) for PRs only | |
| [operations-per-run](#operations-per-run) | Max number of operations per run | `30` | | [operations-per-run](#operations-per-run) | Max number of operations per run | `30` |
| [remove-stale-when-updated](#remove-stale-when-updated) | Remove stale label from issues/PRs on updates | `true` | | [remove-stale-when-updated](#remove-stale-when-updated) | Remove stale label from issues/PRs on updates | `true` |
| [remove-issue-stale-when-updated](#remove-issue-stale-when-updated) | Remove stale label from issues on updates/comments | | | [remove-issue-stale-when-updated](#remove-issue-stale-when-updated) | Remove stale label from issues on updates/comments | |
@ -117,7 +116,8 @@ You can fine tune which issues or pull requests should be marked as stale based
- [exempt-issue-labels](#exempt-issue-labels) - [exempt-issue-labels](#exempt-issue-labels)
- [exempt-pr-labels](#exempt-pr-labels) - [exempt-pr-labels](#exempt-pr-labels)
- [only-labels](#only-labels) - [only-labels](#only-labels)
- [any-of-labels](#any-of-labels) - [any-of-issue-labels](#any-of-issue-labels)
- [any-of-pr-labels](#any-of-pr-labels)
- [start-date](#start-date) - [start-date](#start-date)
- [exempt-issue-milestones](#exempt-issue-milestones) - [exempt-issue-milestones](#exempt-issue-milestones)
- [exempt-pr-milestones](#exempt-pr-milestones) - [exempt-pr-milestones](#exempt-pr-milestones)
@ -260,7 +260,7 @@ It can be a comma separated list of labels (e.g: `answered,needs-rebase`).
If unset (or an empty string), this option will not alter the stale workflow. If unset (or an empty string), this option will not alter the stale workflow.
If you wish to only check that the issues or the pull requests contain one of these label(s), use instead [any-of-labels](#any-of-labels). If you wish to only check that the issues or the pull requests contain one of these label(s), use instead [any-of-issue-labels](#any-of-issue-labels) and [any-of-pr-labels](#any-of-pr-labels).
Default value: unset Default value: unset
@ -276,9 +276,9 @@ Override [only-labels](#only-labels) but only to process the pull requests that
Default value: unset Default value: unset
#### any-of-labels #### any-of-issue-labels
An allow-list of label(s) to only process the issues or the pull requests that contain one of these label(s). An allow-list of label(s) to only process the issues that contain one of these label(s).
It can be a comma separated list of labels (e.g: `answered,needs-rebase`). It can be a comma separated list of labels (e.g: `answered,needs-rebase`).
If unset (or an empty string), this option will not alter the stale workflow. If unset (or an empty string), this option will not alter the stale workflow.
@ -287,15 +287,14 @@ If you wish to only check that the issues or the pull requests contain all these
Default value: unset Default value: unset
#### any-of-issue-labels
Override [any-of-labels](#any-of-labels) but only to process the issues that contain one of these label(s).
Default value: unset
#### any-of-pr-labels #### any-of-pr-labels
Override [any-of-labels](#any-of-labels) but only to process the pull requests that contain one of these label(s). An allow-list of label(s) to only process the pull requests that contain one of these label(s).
It can be a comma separated list of labels (e.g: `answered,needs-rebase`).
If unset (or an empty string), this option will not alter the stale workflow.
If you wish to only check that the issues or the pull requests contain all these label(s), use instead [only-labels](#only-labels).
Default value: unset Default value: unset
@ -667,7 +666,8 @@ jobs:
steps: steps:
- uses: actions/stale@v4 - uses: actions/stale@v4
with: with:
any-of-labels: 'needs-more-info,needs-demo' any-of-issue-labels: 'needs-more-info,needs-demo'
any-of-pr-labels: 'needs-more-info,needs-demo'
# You can opt for 'only-labels' instead if your use-case requires all labels # You can opt for 'only-labels' instead if your use-case requires all labels
# to be present in the issue/PR # to be present in the issue/PR
``` ```

View File

@ -16,7 +16,7 @@ describe('any-of-labels options', (): void => {
test('should stale when not set even if the issue has no label', async (): Promise<void> => { test('should stale when not set even if the issue has no label', async (): Promise<void> => {
expect.assertions(1); expect.assertions(1);
issuesProcessor = issuesProcessorBuilder issuesProcessor = issuesProcessorBuilder
.emptyAnyOfLabels() .emptyAnyOfIssueLabels()
.issuesOrPrs([{labels: []}]) .issuesOrPrs([{labels: []}])
.build(); .build();
@ -28,7 +28,7 @@ describe('any-of-labels options', (): void => {
test('should stale when not set even if the issue has a label', async (): Promise<void> => { test('should stale when not set even if the issue has a label', async (): Promise<void> => {
expect.assertions(1); expect.assertions(1);
issuesProcessor = issuesProcessorBuilder issuesProcessor = issuesProcessorBuilder
.emptyAnyOfLabels() .emptyAnyOfIssueLabels()
.issuesOrPrs([{labels: [{name: 'label'}]}]) .issuesOrPrs([{labels: [{name: 'label'}]}])
.build(); .build();
@ -40,7 +40,7 @@ describe('any-of-labels options', (): void => {
test('should not stale when set and the issue has no label', async (): Promise<void> => { test('should not stale when set and the issue has no label', async (): Promise<void> => {
expect.assertions(1); expect.assertions(1);
issuesProcessor = issuesProcessorBuilder issuesProcessor = issuesProcessorBuilder
.anyOfLabels('dummy-label') .anyOfIssueLabels('dummy-label')
.issuesOrPrs([{labels: []}]) .issuesOrPrs([{labels: []}])
.build(); .build();
@ -52,7 +52,7 @@ describe('any-of-labels options', (): void => {
test('should not stale when set and the issue has a different label', async (): Promise<void> => { test('should not stale when set and the issue has a different label', async (): Promise<void> => {
expect.assertions(1); expect.assertions(1);
issuesProcessor = issuesProcessorBuilder issuesProcessor = issuesProcessorBuilder
.anyOfLabels('dummy-label') .anyOfIssueLabels('dummy-label')
.issuesOrPrs([ .issuesOrPrs([
{ {
labels: [ labels: [
@ -72,7 +72,7 @@ describe('any-of-labels options', (): void => {
test('should not stale when set and the issue has different labels', async (): Promise<void> => { test('should not stale when set and the issue has different labels', async (): Promise<void> => {
expect.assertions(1); expect.assertions(1);
issuesProcessor = issuesProcessorBuilder issuesProcessor = issuesProcessorBuilder
.anyOfLabels('dummy-label') .anyOfIssueLabels('dummy-label')
.issuesOrPrs([ .issuesOrPrs([
{ {
labels: [ labels: [
@ -95,7 +95,7 @@ describe('any-of-labels options', (): void => {
test('should stale when set and the issue has the same label', async (): Promise<void> => { test('should stale when set and the issue has the same label', async (): Promise<void> => {
expect.assertions(1); expect.assertions(1);
issuesProcessor = issuesProcessorBuilder issuesProcessor = issuesProcessorBuilder
.anyOfLabels('dummy-label') .anyOfIssueLabels('dummy-label')
.issuesOrPrs([ .issuesOrPrs([
{ {
labels: [ labels: [
@ -115,7 +115,7 @@ describe('any-of-labels options', (): void => {
test('should stale when set and the issue has only one of the same label', async (): Promise<void> => { test('should stale when set and the issue has only one of the same label', async (): Promise<void> => {
expect.assertions(1); expect.assertions(1);
issuesProcessor = issuesProcessorBuilder issuesProcessor = issuesProcessorBuilder
.anyOfLabels('dummy-label-1,dummy-label-2') .anyOfIssueLabels('dummy-label-1,dummy-label-2')
.issuesOrPrs([ .issuesOrPrs([
{ {
labels: [ labels: [
@ -135,7 +135,7 @@ describe('any-of-labels options', (): void => {
test('should stale when set and the issue has all the same labels', async (): Promise<void> => { test('should stale when set and the issue has all the same labels', async (): Promise<void> => {
expect.assertions(1); expect.assertions(1);
issuesProcessor = issuesProcessorBuilder issuesProcessor = issuesProcessorBuilder
.anyOfLabels('dummy-label-1,dummy-label-2') .anyOfIssueLabels('dummy-label-1,dummy-label-2')
.issuesOrPrs([ .issuesOrPrs([
{ {
labels: [ labels: [
@ -161,11 +161,6 @@ describe('any-of-issue-labels option', (): void => {
issuesProcessorBuilder = new IssuesProcessorBuilder(); issuesProcessorBuilder = new IssuesProcessorBuilder();
}); });
describe('when the any-of-labels options is not set', (): void => {
beforeEach((): void => {
issuesProcessorBuilder.emptyAnyOfLabels();
});
test('should stale when not set even if the issue has no label', async (): Promise<void> => { test('should stale when not set even if the issue has no label', async (): Promise<void> => {
expect.assertions(1); expect.assertions(1);
issuesProcessor = issuesProcessorBuilder issuesProcessor = issuesProcessorBuilder
@ -307,303 +302,6 @@ describe('any-of-issue-labels option', (): void => {
expect(issuesProcessor.staleIssues).toHaveLength(1); expect(issuesProcessor.staleIssues).toHaveLength(1);
}); });
});
describe('when the any-of-labels options is set (same as any-of-issue-labels)', (): void => {
beforeEach((): void => {
issuesProcessorBuilder.anyOfLabels('dummy-label');
});
test('should not stale when not set even if the issue has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyAnyOfIssueLabels()
.issues([{labels: []}])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when not set even if the issue has a label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyAnyOfIssueLabels()
.issues([{labels: [{name: 'label'}]}])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when set and the issue has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfIssueLabels('dummy-label')
.issues([{labels: []}])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when set and the issue has a different label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfIssueLabels('dummy-label')
.issues([
{
labels: [
{
name: 'label'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when set and the issue has different labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfIssueLabels('dummy-label')
.issues([
{
labels: [
{
name: 'label-1'
},
{
name: 'label-2'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should stale when set and the issue has the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfIssueLabels('dummy-label')
.issues([
{
labels: [
{
name: 'dummy-label'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
test('should stale when set and the issue has only one of the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfIssueLabels('dummy-label-1,dummy-label-2')
.issues([
{
labels: [
{
name: 'dummy-label-1'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
test('should stale when set and the issue has all the same labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfIssueLabels('dummy-label-1,dummy-label-2')
.issues([
{
labels: [
{
name: 'dummy-label-1'
},
{
name: 'dummy-label-2'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
});
describe('when the any-of-labels options is set (different than any-of-issue-labels)', (): void => {
beforeEach((): void => {
issuesProcessorBuilder.anyOfLabels('dummy-any-of-label');
});
test('should not stale when not set even if the issue has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyAnyOfIssueLabels()
.issues([{labels: []}])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when not set even if the issue has a label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyAnyOfIssueLabels()
.issues([{labels: [{name: 'label'}]}])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when set and the issue has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfIssueLabels('dummy-label')
.issues([{labels: []}])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when set and the issue has a different label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfIssueLabels('dummy-label')
.issues([
{
labels: [
{
name: 'label'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when set and the issue has different labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfIssueLabels('dummy-label')
.issues([
{
labels: [
{
name: 'label-1'
},
{
name: 'label-2'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should stale when set and the issue has the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfIssueLabels('dummy-label')
.issues([
{
labels: [
{
name: 'dummy-label'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
test('should stale when set and the issue has only one of the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfIssueLabels('dummy-label-1,dummy-label-2')
.issues([
{
labels: [
{
name: 'dummy-label-1'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
test('should stale when set and the issue has all the same labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfIssueLabels('dummy-label-1,dummy-label-2')
.issues([
{
labels: [
{
name: 'dummy-label-1'
},
{
name: 'dummy-label-2'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
});
}); });
describe('any-of-pr-labels option', (): void => { describe('any-of-pr-labels option', (): void => {
@ -611,11 +309,6 @@ describe('any-of-pr-labels option', (): void => {
issuesProcessorBuilder = new IssuesProcessorBuilder(); issuesProcessorBuilder = new IssuesProcessorBuilder();
}); });
describe('when the any-of-labels options is not set', (): void => {
beforeEach((): void => {
issuesProcessorBuilder.emptyAnyOfLabels();
});
test('should stale when not set even if the pr has no label', async (): Promise<void> => { test('should stale when not set even if the pr has no label', async (): Promise<void> => {
expect.assertions(1); expect.assertions(1);
issuesProcessor = issuesProcessorBuilder issuesProcessor = issuesProcessorBuilder
@ -757,303 +450,6 @@ describe('any-of-pr-labels option', (): void => {
expect(issuesProcessor.staleIssues).toHaveLength(1); expect(issuesProcessor.staleIssues).toHaveLength(1);
}); });
});
describe('when the any-of-labels options is set (same as any-of-pr-labels)', (): void => {
beforeEach((): void => {
issuesProcessorBuilder.anyOfLabels('dummy-label');
});
test('should not stale when not set even if the pr has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyAnyOfPrLabels()
.prs([{labels: []}])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when not set even if the pr has a label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyAnyOfPrLabels()
.prs([{labels: [{name: 'label'}]}])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when set and the pr has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfPrLabels('dummy-label')
.prs([{labels: []}])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when set and the pr has a different label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfPrLabels('dummy-label')
.prs([
{
labels: [
{
name: 'label'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when set and the pr has different labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfPrLabels('dummy-label')
.prs([
{
labels: [
{
name: 'label-1'
},
{
name: 'label-2'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should stale when set and the pr has the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfPrLabels('dummy-label')
.prs([
{
labels: [
{
name: 'dummy-label'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
test('should stale when set and the pr has only one of the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfPrLabels('dummy-label-1,dummy-label-2')
.prs([
{
labels: [
{
name: 'dummy-label-1'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
test('should stale when set and the pr has all the same labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfPrLabels('dummy-label-1,dummy-label-2')
.prs([
{
labels: [
{
name: 'dummy-label-1'
},
{
name: 'dummy-label-2'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
});
describe('when the any-of-labels options is set (different than any-of-pr-labels)', (): void => {
beforeEach((): void => {
issuesProcessorBuilder.anyOfLabels('dummy-any-of-label');
});
test('should not stale when not set even if the pr has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyAnyOfPrLabels()
.prs([{labels: []}])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when not set even if the pr has a label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyAnyOfPrLabels()
.prs([{labels: [{name: 'label'}]}])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when set and the pr has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfPrLabels('dummy-label')
.prs([{labels: []}])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when set and the pr has a different label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfPrLabels('dummy-label')
.prs([
{
labels: [
{
name: 'label'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should not stale when set and the pr has different labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfPrLabels('dummy-label')
.prs([
{
labels: [
{
name: 'label-1'
},
{
name: 'label-2'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should stale when set and the pr has the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfPrLabels('dummy-label')
.prs([
{
labels: [
{
name: 'dummy-label'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
test('should stale when set and the pr has only one of the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfPrLabels('dummy-label-1,dummy-label-2')
.prs([
{
labels: [
{
name: 'dummy-label-1'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
test('should stale when set and the pr has all the same labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.anyOfPrLabels('dummy-label-1,dummy-label-2')
.prs([
{
labels: [
{
name: 'dummy-label-1'
},
{
name: 'dummy-label-2'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
});
}); });
class IssuesProcessorBuilder { class IssuesProcessorBuilder {
@ -1063,12 +459,6 @@ class IssuesProcessorBuilder {
}; };
private _issues: Issue[] = []; private _issues: Issue[] = [];
anyOfLabels(labels: string): IssuesProcessorBuilder {
this._options.anyOfLabels = labels;
return this;
}
anyOfIssueLabels(labels: string): IssuesProcessorBuilder { anyOfIssueLabels(labels: string): IssuesProcessorBuilder {
this._options.anyOfIssueLabels = labels; this._options.anyOfIssueLabels = labels;
@ -1081,10 +471,6 @@ class IssuesProcessorBuilder {
return this; return this;
} }
emptyAnyOfLabels(): IssuesProcessorBuilder {
return this.anyOfLabels('');
}
emptyAnyOfIssueLabels(): IssuesProcessorBuilder { emptyAnyOfIssueLabels(): IssuesProcessorBuilder {
return this.anyOfIssueLabels(''); return this.anyOfIssueLabels('');
} }

View File

@ -80,16 +80,12 @@ inputs:
description: 'Only issues or pull requests with all of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels.' description: 'Only issues or pull requests with all of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels.'
default: '' default: ''
required: false required: false
any-of-labels:
description: 'Only issues or pull requests with at least one of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels.'
default: ''
required: false
any-of-issue-labels: any-of-issue-labels:
description: 'Only issues with at least one of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels. Override "any-of-labels" option regarding only the issues.' description: 'Only issues with at least one of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels.'
default: '' default: ''
required: false required: false
any-of-pr-labels: any-of-pr-labels:
description: 'Only pull requests with at least one of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels. Override "any-of-labels" option regarding only the pull requests.' description: 'Only pull requests with at least one of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels.'
default: '' default: ''
required: false required: false
only-issue-labels: only-issue-labels:

15
dist/index.js vendored
View File

@ -482,7 +482,7 @@ class IssuesProcessor {
} }
const anyOfLabels = words_to_list_1.wordsToList(this._getAnyOfLabels(issue)); const anyOfLabels = words_to_list_1.wordsToList(this._getAnyOfLabels(issue));
if (anyOfLabels.length > 0) { if (anyOfLabels.length > 0) {
issueLogger.info(`The option ${issueLogger.createOptionLink(option_1.Option.AnyOfLabels)} was specified to only process the issues and pull requests with one of those labels (${logger_service_1.LoggerService.cyan(anyOfLabels.length)})`); issueLogger.info(`The option ${issueLogger.createOptionLink(issue.isPullRequest ? option_1.Option.AnyOfPrLabels : option_1.Option.AnyOfIssueLabels)} was specified to only process the issues and pull requests with one of those labels (${logger_service_1.LoggerService.cyan(anyOfLabels.length)})`);
const hasOneOfWhitelistedLabels = anyOfLabels.some((label) => { const hasOneOfWhitelistedLabels = anyOfLabels.some((label) => {
return is_labeled_1.isLabeled(issue, label); return is_labeled_1.isLabeled(issue, label);
}); });
@ -497,7 +497,7 @@ class IssuesProcessor {
} }
} }
else { else {
issueLogger.info(`The option ${issueLogger.createOptionLink(option_1.Option.AnyOfLabels)} was not specified`); issueLogger.info(`The option ${issueLogger.createOptionLink(issue.isPullRequest ? option_1.Option.AnyOfPrLabels : option_1.Option.AnyOfIssueLabels)} was not specified`);
issueLogger.info(logger_service_1.LoggerService.white('└──'), `Continuing the process for this $$type`); issueLogger.info(logger_service_1.LoggerService.white('└──'), `Continuing the process for this $$type`);
} }
const milestones = new milestones_1.Milestones(this.options, issue); const milestones = new milestones_1.Milestones(this.options, issue);
@ -925,17 +925,10 @@ class IssuesProcessor {
} }
_getAnyOfLabels(issue) { _getAnyOfLabels(issue) {
if (issue.isPullRequest) { if (issue.isPullRequest) {
if (this.options.anyOfPrLabels !== '') {
return this.options.anyOfPrLabels; return this.options.anyOfPrLabels;
} }
}
else {
if (this.options.anyOfIssueLabels !== '') {
return this.options.anyOfIssueLabels; return this.options.anyOfIssueLabels;
} }
}
return this.options.anyOfLabels;
}
_shouldRemoveStaleWhenUpdated(issue) { _shouldRemoveStaleWhenUpdated(issue) {
if (issue.isPullRequest) { if (issue.isPullRequest) {
if (is_boolean_1.isBoolean(this.options.removePrStaleWhenUpdated)) { if (is_boolean_1.isBoolean(this.options.removePrStaleWhenUpdated)) {
@ -1774,7 +1767,8 @@ var Option;
Option["OnlyLabels"] = "only-labels"; Option["OnlyLabels"] = "only-labels";
Option["OnlyIssueLabels"] = "only-issue-labels"; Option["OnlyIssueLabels"] = "only-issue-labels";
Option["OnlyPrLabels"] = "only-pr-labels"; Option["OnlyPrLabels"] = "only-pr-labels";
Option["AnyOfLabels"] = "any-of-labels"; Option["AnyOfIssueLabels"] = "any-of-issue-labels";
Option["AnyOfPrLabels"] = "any-of-pr-labels";
Option["OperationsPerRun"] = "operations-per-run"; Option["OperationsPerRun"] = "operations-per-run";
Option["RemoveStaleWhenUpdated"] = "remove-stale-when-updated"; Option["RemoveStaleWhenUpdated"] = "remove-stale-when-updated";
Option["RemoveIssueStaleWhenUpdated"] = "remove-issue-stale-when-updated"; Option["RemoveIssueStaleWhenUpdated"] = "remove-issue-stale-when-updated";
@ -2076,7 +2070,6 @@ function _getAndValidateArgs() {
onlyLabels: core.getInput('only-labels'), onlyLabels: core.getInput('only-labels'),
onlyIssueLabels: core.getInput('only-issue-labels'), onlyIssueLabels: core.getInput('only-issue-labels'),
onlyPrLabels: core.getInput('only-pr-labels'), onlyPrLabels: core.getInput('only-pr-labels'),
anyOfLabels: core.getInput('any-of-labels'),
anyOfIssueLabels: core.getInput('any-of-issue-labels'), anyOfIssueLabels: core.getInput('any-of-issue-labels'),
anyOfPrLabels: core.getInput('any-of-pr-labels'), anyOfPrLabels: core.getInput('any-of-pr-labels'),
operationsPerRun: parseInt(core.getInput('operations-per-run', { required: true })), operationsPerRun: parseInt(core.getInput('operations-per-run', { required: true })),

View File

@ -30,7 +30,6 @@ describe('Issue', (): void => {
onlyLabels: '', onlyLabels: '',
onlyIssueLabels: '', onlyIssueLabels: '',
onlyPrLabels: '', onlyPrLabels: '',
anyOfLabels: '',
anyOfIssueLabels: '', anyOfIssueLabels: '',
anyOfPrLabels: '', anyOfPrLabels: '',
operationsPerRun: 0, operationsPerRun: 0,

View File

@ -345,7 +345,7 @@ export class IssuesProcessor {
if (anyOfLabels.length > 0) { if (anyOfLabels.length > 0) {
issueLogger.info( issueLogger.info(
`The option ${issueLogger.createOptionLink( `The option ${issueLogger.createOptionLink(
Option.AnyOfLabels issue.isPullRequest ? Option.AnyOfPrLabels : Option.AnyOfIssueLabels
)} was specified to only process the issues and pull requests with one of those labels (${LoggerService.cyan( )} was specified to only process the issues and pull requests with one of those labels (${LoggerService.cyan(
anyOfLabels.length anyOfLabels.length
)})` )})`
@ -377,7 +377,7 @@ export class IssuesProcessor {
} else { } else {
issueLogger.info( issueLogger.info(
`The option ${issueLogger.createOptionLink( `The option ${issueLogger.createOptionLink(
Option.AnyOfLabels issue.isPullRequest ? Option.AnyOfPrLabels : Option.AnyOfIssueLabels
)} was not specified` )} was not specified`
); );
issueLogger.info( issueLogger.info(
@ -997,16 +997,10 @@ export class IssuesProcessor {
private _getAnyOfLabels(issue: Issue): string { private _getAnyOfLabels(issue: Issue): string {
if (issue.isPullRequest) { if (issue.isPullRequest) {
if (this.options.anyOfPrLabels !== '') {
return this.options.anyOfPrLabels; return this.options.anyOfPrLabels;
} }
} else {
if (this.options.anyOfIssueLabels !== '') {
return this.options.anyOfIssueLabels;
}
}
return this.options.anyOfLabels; return this.options.anyOfIssueLabels;
} }
private _shouldRemoveStaleWhenUpdated(issue: Issue): boolean { private _shouldRemoveStaleWhenUpdated(issue: Issue): boolean {

View File

@ -19,7 +19,8 @@ export enum Option {
OnlyLabels = 'only-labels', OnlyLabels = 'only-labels',
OnlyIssueLabels = 'only-issue-labels', OnlyIssueLabels = 'only-issue-labels',
OnlyPrLabels = 'only-pr-labels', OnlyPrLabels = 'only-pr-labels',
AnyOfLabels = 'any-of-labels', AnyOfIssueLabels = 'any-of-issue-labels',
AnyOfPrLabels = 'any-of-pr-labels',
OperationsPerRun = 'operations-per-run', OperationsPerRun = 'operations-per-run',
RemoveStaleWhenUpdated = 'remove-stale-when-updated', RemoveStaleWhenUpdated = 'remove-stale-when-updated',
RemoveIssueStaleWhenUpdated = 'remove-issue-stale-when-updated', RemoveIssueStaleWhenUpdated = 'remove-issue-stale-when-updated',

View File

@ -21,7 +21,6 @@ export interface IIssuesProcessorOptions {
onlyLabels: string; onlyLabels: string;
onlyIssueLabels: string; onlyIssueLabels: string;
onlyPrLabels: string; onlyPrLabels: string;
anyOfLabels: string;
anyOfIssueLabels: string; anyOfIssueLabels: string;
anyOfPrLabels: string; anyOfPrLabels: string;
operationsPerRun: number; operationsPerRun: number;

View File

@ -47,7 +47,6 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
onlyLabels: core.getInput('only-labels'), onlyLabels: core.getInput('only-labels'),
onlyIssueLabels: core.getInput('only-issue-labels'), onlyIssueLabels: core.getInput('only-issue-labels'),
onlyPrLabels: core.getInput('only-pr-labels'), onlyPrLabels: core.getInput('only-pr-labels'),
anyOfLabels: core.getInput('any-of-labels'),
anyOfIssueLabels: core.getInput('any-of-issue-labels'), anyOfIssueLabels: core.getInput('any-of-issue-labels'),
anyOfPrLabels: core.getInput('any-of-pr-labels'), anyOfPrLabels: core.getInput('any-of-pr-labels'),
operationsPerRun: parseInt( operationsPerRun: parseInt(