feat: remove the only-labels option
BREAKING CHANGE: The option only-labels was removed
This commit is contained in:
parent
1c81c38e2f
commit
a8c5bb1c29
36
README.md
36
README.md
|
@ -47,9 +47,8 @@ Every argument is optional.
|
|||
| [close-pr-label](#close-pr-label) | Label to apply on closed PRs | |
|
||||
| [exempt-issue-labels](#exempt-issue-labels) | Labels on issues exempted from stale | |
|
||||
| [exempt-pr-labels](#exempt-pr-labels) | Labels on PRs exempted from stale | |
|
||||
| [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-pr-labels](#only-pr-labels) | Override [only-labels](#only-labels) for PRs only | |
|
||||
| [only-issue-labels](#only-issue-labels) | Only issues with ALL these labels are checked | |
|
||||
| [only-pr-labels](#only-pr-labels) | Only PRs with ALL these labels are checked | |
|
||||
| [any-of-issue-labels](#any-of-issue-labels) | Only issues with ANY of these labels are checked | |
|
||||
| [any-of-pr-labels](#any-of-pr-labels) | Only PRs with ANY of these labels are checked | |
|
||||
| [operations-per-run](#operations-per-run) | Max number of operations per run | `30` |
|
||||
|
@ -115,7 +114,8 @@ You can fine tune which issues or pull requests should be marked as stale based
|
|||
|
||||
- [exempt-issue-labels](#exempt-issue-labels)
|
||||
- [exempt-pr-labels](#exempt-pr-labels)
|
||||
- [only-labels](#only-labels)
|
||||
- [only-issue-labels](#only-issue-labels)
|
||||
- [only-pr-labels](#only-pr-labels)
|
||||
- [any-of-issue-labels](#any-of-issue-labels)
|
||||
- [any-of-pr-labels](#any-of-pr-labels)
|
||||
- [start-date](#start-date)
|
||||
|
@ -253,26 +253,25 @@ If unset (or an empty string), this option will not alter the stale workflow.
|
|||
|
||||
Default value: unset
|
||||
|
||||
#### only-labels
|
||||
#### only-issue-labels
|
||||
|
||||
An allow-list of label(s) to only process the issues or the pull requests that contain all these label(s).
|
||||
An allow-list of label(s) to only process the issues that contain all 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 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
|
||||
|
||||
#### only-issue-labels
|
||||
|
||||
Override [only-labels](#only-labels) but only to process the issues that contain all these label(s).
|
||||
If you wish to only check that the issues contain one of these label(s), use instead [any-of-issue-labels](#any-of-issue-labels).
|
||||
|
||||
Default value: unset
|
||||
|
||||
#### only-pr-labels
|
||||
|
||||
Override [only-labels](#only-labels) but only to process the pull requests that contain all these label(s).
|
||||
An allow-list of label(s) to only process the pull requests that contain all 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 pull requests contain one of these label(s), use instead [any-of-pr-labels](#any-of-pr-labels).
|
||||
|
||||
Default value: unset
|
||||
|
||||
|
@ -283,7 +282,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 you wish to only check that the issues or the pull requests contain all these label(s), use instead [only-labels](#only-labels).
|
||||
If you wish to only check that the issues or the pull requests contain all these label(s), use instead [only-issue-labels](#only-issue-labels).
|
||||
|
||||
Default value: unset
|
||||
|
||||
|
@ -294,7 +293,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 you wish to only check that the issues or the pull requests contain all these label(s), use instead [only-labels](#only-labels).
|
||||
If you wish to only check that the issues or the pull requests contain all these label(s), use instead [only-pr-labels](#only-pr-labels).
|
||||
|
||||
Default value: unset
|
||||
|
||||
|
@ -597,7 +596,8 @@ jobs:
|
|||
exempt-issue-labels: 'awaiting-approval,work-in-progress'
|
||||
stale-pr-label: 'no-pr-activity'
|
||||
exempt-pr-labels: 'awaiting-approval,work-in-progress'
|
||||
only-labels: 'awaiting-feedback,awaiting-answers'
|
||||
only-issue-labels: 'awaiting-feedback,awaiting-answers'
|
||||
only-pr-labels: 'awaiting-feedback,awaiting-answers'
|
||||
```
|
||||
|
||||
Configure the stale action to only stale issue/PR created after the 18th april 2020:
|
||||
|
@ -668,7 +668,7 @@ jobs:
|
|||
with:
|
||||
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-issue-labels' and 'only-pr-labels' instead if your use-case requires all labels
|
||||
# to be present in the issue/PR
|
||||
```
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -76,16 +76,12 @@ inputs:
|
|||
description: 'Exempt all pull requests with milestones from being marked as stale. Default to false.'
|
||||
default: 'false'
|
||||
required: false
|
||||
only-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: ''
|
||||
required: false
|
||||
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.'
|
||||
description: 'Only issues with all of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels.'
|
||||
default: ''
|
||||
required: false
|
||||
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.'
|
||||
description: 'Only pull requests with all of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels.'
|
||||
default: ''
|
||||
required: false
|
||||
only-issue-labels:
|
||||
|
|
|
@ -293,24 +293,24 @@ exports.IssuesProcessor = void 0;
|
|||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const github_1 = __nccwpck_require__(5438);
|
||||
const option_1 = __nccwpck_require__(5931);
|
||||
const clean_label_1 = __nccwpck_require__(7752);
|
||||
const get_humanized_date_1 = __nccwpck_require__(965);
|
||||
const is_date_more_recent_than_1 = __nccwpck_require__(1473);
|
||||
const is_valid_date_1 = __nccwpck_require__(891);
|
||||
const is_boolean_1 = __nccwpck_require__(8236);
|
||||
const is_labeled_1 = __nccwpck_require__(6792);
|
||||
const clean_label_1 = __nccwpck_require__(7752);
|
||||
const should_mark_when_stale_1 = __nccwpck_require__(2461);
|
||||
const words_to_list_1 = __nccwpck_require__(1883);
|
||||
const logger_service_1 = __nccwpck_require__(1973);
|
||||
const assignees_1 = __nccwpck_require__(7236);
|
||||
const ignore_updates_1 = __nccwpck_require__(2935);
|
||||
const exempt_draft_pull_request_1 = __nccwpck_require__(854);
|
||||
const ignore_updates_1 = __nccwpck_require__(2935);
|
||||
const issue_1 = __nccwpck_require__(4783);
|
||||
const issue_logger_1 = __nccwpck_require__(2984);
|
||||
const logger_1 = __nccwpck_require__(6212);
|
||||
const milestones_1 = __nccwpck_require__(4601);
|
||||
const stale_operations_1 = __nccwpck_require__(5080);
|
||||
const statistics_1 = __nccwpck_require__(3334);
|
||||
const logger_service_1 = __nccwpck_require__(1973);
|
||||
/***
|
||||
* Handle processing of issues for staleness/closure.
|
||||
*/
|
||||
|
@ -423,7 +423,7 @@ class IssuesProcessor {
|
|||
}
|
||||
const onlyLabels = words_to_list_1.wordsToList(this._getOnlyLabels(issue));
|
||||
if (onlyLabels.length > 0) {
|
||||
issueLogger.info(`The option ${issueLogger.createOptionLink(option_1.Option.OnlyLabels)} was specified to only process issues and pull requests with all those labels (${logger_service_1.LoggerService.cyan(onlyLabels.length)})`);
|
||||
issueLogger.info(`The option ${issueLogger.createOptionLink(issue.isPullRequest ? option_1.Option.OnlyPrLabels : option_1.Option.OnlyIssueLabels)} was specified to only process issues and pull requests with all those labels (${logger_service_1.LoggerService.cyan(onlyLabels.length)})`);
|
||||
const hasAllWhitelistedLabels = onlyLabels.every((label) => {
|
||||
return is_labeled_1.isLabeled(issue, label);
|
||||
});
|
||||
|
@ -438,7 +438,7 @@ class IssuesProcessor {
|
|||
}
|
||||
}
|
||||
else {
|
||||
issueLogger.info(`The option ${issueLogger.createOptionLink(option_1.Option.OnlyLabels)} was not specified`);
|
||||
issueLogger.info(`The option ${issueLogger.createOptionLink(issue.isPullRequest ? option_1.Option.OnlyPrLabels : option_1.Option.OnlyIssueLabels)} was not specified`);
|
||||
issueLogger.info(logger_service_1.LoggerService.white('└──'), `Continuing the process for this $$type`);
|
||||
}
|
||||
issueLogger.info(`Days before $$type stale: ${logger_service_1.LoggerService.cyan(daysBeforeStale)}`);
|
||||
|
@ -912,16 +912,9 @@ class IssuesProcessor {
|
|||
}
|
||||
_getOnlyLabels(issue) {
|
||||
if (issue.isPullRequest) {
|
||||
if (this.options.onlyPrLabels !== '') {
|
||||
return this.options.onlyPrLabels;
|
||||
}
|
||||
return this.options.onlyPrLabels;
|
||||
}
|
||||
else {
|
||||
if (this.options.onlyIssueLabels !== '') {
|
||||
return this.options.onlyIssueLabels;
|
||||
}
|
||||
}
|
||||
return this.options.onlyLabels;
|
||||
return this.options.onlyIssueLabels;
|
||||
}
|
||||
_getAnyOfLabels(issue) {
|
||||
if (issue.isPullRequest) {
|
||||
|
@ -1764,7 +1757,6 @@ var Option;
|
|||
Option["StalePrLabel"] = "stale-pr-label";
|
||||
Option["ClosePrLabel"] = "close-pr-label";
|
||||
Option["ExemptPrLabels"] = "exempt-pr-labels";
|
||||
Option["OnlyLabels"] = "only-labels";
|
||||
Option["OnlyIssueLabels"] = "only-issue-labels";
|
||||
Option["OnlyPrLabels"] = "only-pr-labels";
|
||||
Option["AnyOfIssueLabels"] = "any-of-issue-labels";
|
||||
|
@ -2067,7 +2059,6 @@ function _getAndValidateArgs() {
|
|||
stalePrLabel: core.getInput('stale-pr-label', { required: true }),
|
||||
closePrLabel: core.getInput('close-pr-label'),
|
||||
exemptPrLabels: core.getInput('exempt-pr-labels'),
|
||||
onlyLabels: core.getInput('only-labels'),
|
||||
onlyIssueLabels: core.getInput('only-issue-labels'),
|
||||
onlyPrLabels: core.getInput('only-pr-labels'),
|
||||
anyOfIssueLabels: core.getInput('any-of-issue-labels'),
|
||||
|
|
|
@ -27,7 +27,6 @@ describe('Issue', (): void => {
|
|||
deleteBranch: false,
|
||||
exemptIssueLabels: '',
|
||||
exemptPrLabels: '',
|
||||
onlyLabels: '',
|
||||
onlyIssueLabels: '',
|
||||
onlyPrLabels: '',
|
||||
anyOfIssueLabels: '',
|
||||
|
|
|
@ -3,29 +3,29 @@ import {context, getOctokit} from '@actions/github';
|
|||
import {GitHub} from '@actions/github/lib/utils';
|
||||
import {GetResponseTypeFromEndpointMethod} from '@octokit/types';
|
||||
import {Option} from '../enums/option';
|
||||
import {cleanLabel} from '../functions/clean-label';
|
||||
import {getHumanizedDate} from '../functions/dates/get-humanized-date';
|
||||
import {isDateMoreRecentThan} from '../functions/dates/is-date-more-recent-than';
|
||||
import {isValidDate} from '../functions/dates/is-valid-date';
|
||||
import {isBoolean} from '../functions/is-boolean';
|
||||
import {isLabeled} from '../functions/is-labeled';
|
||||
import {cleanLabel} from '../functions/clean-label';
|
||||
import {shouldMarkWhenStale} from '../functions/should-mark-when-stale';
|
||||
import {wordsToList} from '../functions/words-to-list';
|
||||
import {IComment} from '../interfaces/comment';
|
||||
import {IIssue} from '../interfaces/issue';
|
||||
import {IIssueEvent} from '../interfaces/issue-event';
|
||||
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||
import {IPullRequest} from '../interfaces/pull-request';
|
||||
import {LoggerService} from '../services/logger.service';
|
||||
import {Assignees} from './assignees';
|
||||
import {IgnoreUpdates} from './ignore-updates';
|
||||
import {ExemptDraftPullRequest} from './exempt-draft-pull-request';
|
||||
import {IgnoreUpdates} from './ignore-updates';
|
||||
import {Issue} from './issue';
|
||||
import {IssueLogger} from './loggers/issue-logger';
|
||||
import {Logger} from './loggers/logger';
|
||||
import {Milestones} from './milestones';
|
||||
import {StaleOperations} from './stale-operations';
|
||||
import {Statistics} from './statistics';
|
||||
import {LoggerService} from '../services/logger.service';
|
||||
import {IIssue} from '../interfaces/issue';
|
||||
|
||||
/***
|
||||
* Handle processing of issues for staleness/closure.
|
||||
|
@ -227,7 +227,7 @@ export class IssuesProcessor {
|
|||
if (onlyLabels.length > 0) {
|
||||
issueLogger.info(
|
||||
`The option ${issueLogger.createOptionLink(
|
||||
Option.OnlyLabels
|
||||
issue.isPullRequest ? Option.OnlyPrLabels : Option.OnlyIssueLabels
|
||||
)} was specified to only process issues and pull requests with all those labels (${LoggerService.cyan(
|
||||
onlyLabels.length
|
||||
)})`
|
||||
|
@ -260,7 +260,7 @@ export class IssuesProcessor {
|
|||
} else {
|
||||
issueLogger.info(
|
||||
`The option ${issueLogger.createOptionLink(
|
||||
Option.OnlyLabels
|
||||
issue.isPullRequest ? Option.OnlyPrLabels : Option.OnlyIssueLabels
|
||||
)} was not specified`
|
||||
);
|
||||
issueLogger.info(
|
||||
|
@ -983,16 +983,10 @@ export class IssuesProcessor {
|
|||
|
||||
private _getOnlyLabels(issue: Issue): string {
|
||||
if (issue.isPullRequest) {
|
||||
if (this.options.onlyPrLabels !== '') {
|
||||
return this.options.onlyPrLabels;
|
||||
}
|
||||
} else {
|
||||
if (this.options.onlyIssueLabels !== '') {
|
||||
return this.options.onlyIssueLabels;
|
||||
}
|
||||
return this.options.onlyPrLabels;
|
||||
}
|
||||
|
||||
return this.options.onlyLabels;
|
||||
return this.options.onlyIssueLabels;
|
||||
}
|
||||
|
||||
private _getAnyOfLabels(issue: Issue): string {
|
||||
|
|
|
@ -16,7 +16,6 @@ export enum Option {
|
|||
StalePrLabel = 'stale-pr-label',
|
||||
ClosePrLabel = 'close-pr-label',
|
||||
ExemptPrLabels = 'exempt-pr-labels',
|
||||
OnlyLabels = 'only-labels',
|
||||
OnlyIssueLabels = 'only-issue-labels',
|
||||
OnlyPrLabels = 'only-pr-labels',
|
||||
AnyOfIssueLabels = 'any-of-issue-labels',
|
||||
|
|
|
@ -18,7 +18,6 @@ export interface IIssuesProcessorOptions {
|
|||
stalePrLabel: string;
|
||||
closePrLabel: string;
|
||||
exemptPrLabels: string;
|
||||
onlyLabels: string;
|
||||
onlyIssueLabels: string;
|
||||
onlyPrLabels: string;
|
||||
anyOfIssueLabels: string;
|
||||
|
|
|
@ -44,7 +44,6 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
|
|||
stalePrLabel: core.getInput('stale-pr-label', {required: true}),
|
||||
closePrLabel: core.getInput('close-pr-label'),
|
||||
exemptPrLabels: core.getInput('exempt-pr-labels'),
|
||||
onlyLabels: core.getInput('only-labels'),
|
||||
onlyIssueLabels: core.getInput('only-issue-labels'),
|
||||
onlyPrLabels: core.getInput('only-pr-labels'),
|
||||
anyOfIssueLabels: core.getInput('any-of-issue-labels'),
|
||||
|
|
Loading…
Reference in New Issue