feat: remove the any-of-labels option
BREAKING CHANGE: The option any-of-labels was removed
This commit is contained in:
parent
f6a70aa856
commit
1c81c38e2f
30
README.md
30
README.md
|
@ -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
|
||||||
```
|
```
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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:
|
||||||
|
|
|
@ -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,16 +925,9 @@ 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 {
|
return this.options.anyOfIssueLabels;
|
||||||
if (this.options.anyOfIssueLabels !== '') {
|
|
||||||
return this.options.anyOfIssueLabels;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.options.anyOfLabels;
|
|
||||||
}
|
}
|
||||||
_shouldRemoveStaleWhenUpdated(issue) {
|
_shouldRemoveStaleWhenUpdated(issue) {
|
||||||
if (issue.isPullRequest) {
|
if (issue.isPullRequest) {
|
||||||
|
@ -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 })),
|
||||||
|
|
|
@ -30,7 +30,6 @@ describe('Issue', (): void => {
|
||||||
onlyLabels: '',
|
onlyLabels: '',
|
||||||
onlyIssueLabels: '',
|
onlyIssueLabels: '',
|
||||||
onlyPrLabels: '',
|
onlyPrLabels: '',
|
||||||
anyOfLabels: '',
|
|
||||||
anyOfIssueLabels: '',
|
anyOfIssueLabels: '',
|
||||||
anyOfPrLabels: '',
|
anyOfPrLabels: '',
|
||||||
operationsPerRun: 0,
|
operationsPerRun: 0,
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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(
|
||||||
|
|
Loading…
Reference in New Issue