feat: remove the only-labels option

BREAKING CHANGE:
The option only-labels was removed
This commit is contained in:
TESTELIN Geoffrey 2021-10-08 20:26:58 +02:00
parent 1c81c38e2f
commit a8c5bb1c29
No known key found for this signature in database
GPG Key ID: 05D28E8D8E8E52DA
9 changed files with 568 additions and 1205 deletions

View File

@ -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
```

View File

@ -16,7 +16,7 @@ describe('only-labels options', (): void => {
test('should stale when not set even if the issue has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyOnlyLabels()
.emptyOnlyIssueLabels()
.issuesOrPrs([{labels: []}])
.build();
@ -28,7 +28,7 @@ describe('only-labels options', (): void => {
test('should stale when not set even if the issue has a label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyOnlyLabels()
.emptyOnlyIssueLabels()
.issuesOrPrs([{labels: [{name: 'label'}]}])
.build();
@ -40,7 +40,7 @@ describe('only-labels options', (): void => {
test('should not stale when set and the issue has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyLabels('dummy-label')
.onlyIssueLabels('dummy-label')
.issuesOrPrs([{labels: []}])
.build();
@ -52,7 +52,7 @@ describe('only-labels options', (): void => {
test('should not stale when set and the issue has a different label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyLabels('dummy-label')
.onlyIssueLabels('dummy-label')
.issuesOrPrs([
{
labels: [
@ -72,7 +72,7 @@ describe('only-labels options', (): void => {
test('should not stale when set and the issue has different labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyLabels('dummy-label')
.onlyIssueLabels('dummy-label')
.issuesOrPrs([
{
labels: [
@ -95,7 +95,7 @@ describe('only-labels options', (): void => {
test('should stale when set and the issue has the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyLabels('dummy-label')
.onlyIssueLabels('dummy-label')
.issuesOrPrs([
{
labels: [
@ -115,7 +115,7 @@ describe('only-labels options', (): void => {
test('should not stale when set and the issue has only one of the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyLabels('dummy-label-1,dummy-label-2')
.onlyIssueLabels('dummy-label-1,dummy-label-2')
.issuesOrPrs([
{
labels: [
@ -135,7 +135,7 @@ describe('only-labels options', (): void => {
test('should stale when set and the issue has all the same labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyLabels('dummy-label-1,dummy-label-2')
.onlyIssueLabels('dummy-label-1,dummy-label-2')
.issuesOrPrs([
{
labels: [
@ -161,11 +161,6 @@ describe('only-issue-labels option', (): void => {
issuesProcessorBuilder = new IssuesProcessorBuilder();
});
describe('when the only-labels options is not set', (): void => {
beforeEach((): void => {
issuesProcessorBuilder.emptyOnlyLabels();
});
test('should stale when not set even if the issue has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
@ -309,313 +304,11 @@ describe('only-issue-labels option', (): void => {
});
});
describe('when the only-labels options is set (same as only-issue-labels)', (): void => {
beforeEach((): void => {
issuesProcessorBuilder.onlyLabels('dummy-label');
});
test('should not stale when not set even if the issue has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyOnlyIssueLabels()
.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
.emptyOnlyIssueLabels()
.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
.onlyIssueLabels('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
.onlyIssueLabels('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
.onlyIssueLabels('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
.onlyIssueLabels('dummy-label')
.issues([
{
labels: [
{
name: 'dummy-label'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
test('should not stale when set and the issue has only one of the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyIssueLabels('dummy-label-1,dummy-label-2')
.issues([
{
labels: [
{
name: 'dummy-label-1'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should stale when set and the issue has all the same labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyIssueLabels('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 only-labels options is set (different than only-issue-labels)', (): void => {
beforeEach((): void => {
issuesProcessorBuilder.onlyLabels('dummy-only-label');
});
test('should not stale when not set even if the issue has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyOnlyIssueLabels()
.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
.emptyOnlyIssueLabels()
.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
.onlyIssueLabels('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
.onlyIssueLabels('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
.onlyIssueLabels('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
.onlyIssueLabels('dummy-label')
.issues([
{
labels: [
{
name: 'dummy-label'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
test('should not stale when set and the issue has only one of the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyIssueLabels('dummy-label-1,dummy-label-2')
.issues([
{
labels: [
{
name: 'dummy-label-1'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should stale when set and the issue has all the same labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyIssueLabels('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('only-pr-labels option', (): void => {
beforeEach((): void => {
issuesProcessorBuilder = new IssuesProcessorBuilder();
});
describe('when the only-labels options is not set', (): void => {
beforeEach((): void => {
issuesProcessorBuilder.emptyOnlyLabels();
});
test('should stale when not set even if the pr has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
@ -759,303 +452,6 @@ describe('only-pr-labels option', (): void => {
});
});
describe('when the only-labels options is set (same as only-pr-labels)', (): void => {
beforeEach((): void => {
issuesProcessorBuilder.onlyLabels('dummy-label');
});
test('should not stale when not set even if the pr has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyOnlyPrLabels()
.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
.emptyOnlyPrLabels()
.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
.onlyPrLabels('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
.onlyPrLabels('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
.onlyPrLabels('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
.onlyPrLabels('dummy-label')
.prs([
{
labels: [
{
name: 'dummy-label'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
test('should not stale when set and the pr has only one of the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyPrLabels('dummy-label-1,dummy-label-2')
.prs([
{
labels: [
{
name: 'dummy-label-1'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should stale when set and the pr has all the same labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyPrLabels('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 only-labels options is set (different than only-pr-labels)', (): void => {
beforeEach((): void => {
issuesProcessorBuilder.onlyLabels('dummy-only-label');
});
test('should not stale when not set even if the pr has no label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.emptyOnlyPrLabels()
.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
.emptyOnlyPrLabels()
.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
.onlyPrLabels('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
.onlyPrLabels('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
.onlyPrLabels('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
.onlyPrLabels('dummy-label')
.prs([
{
labels: [
{
name: 'dummy-label'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(1);
});
test('should not stale when set and the pr has only one of the same label', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyPrLabels('dummy-label-1,dummy-label-2')
.prs([
{
labels: [
{
name: 'dummy-label-1'
}
]
}
])
.build();
await issuesProcessor.processIssues();
expect(issuesProcessor.staleIssues).toHaveLength(0);
});
test('should stale when set and the pr has all the same labels', async (): Promise<void> => {
expect.assertions(1);
issuesProcessor = issuesProcessorBuilder
.onlyPrLabels('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 {
private _options: IIssuesProcessorOptions = {
...DefaultProcessorOptions,
@ -1063,12 +459,6 @@ class IssuesProcessorBuilder {
};
private _issues: Issue[] = [];
onlyLabels(labels: string): IssuesProcessorBuilder {
this._options.onlyLabels = labels;
return this;
}
onlyIssueLabels(labels: string): IssuesProcessorBuilder {
this._options.onlyIssueLabels = labels;
@ -1081,10 +471,6 @@ class IssuesProcessorBuilder {
return this;
}
emptyOnlyLabels(): IssuesProcessorBuilder {
return this.onlyLabels('');
}
emptyOnlyIssueLabels(): IssuesProcessorBuilder {
return this.onlyIssueLabels('');
}

View File

@ -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:

19
dist/index.js vendored
View File

@ -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,17 +912,10 @@ class IssuesProcessor {
}
_getOnlyLabels(issue) {
if (issue.isPullRequest) {
if (this.options.onlyPrLabels !== '') {
return this.options.onlyPrLabels;
}
}
else {
if (this.options.onlyIssueLabels !== '') {
return this.options.onlyIssueLabels;
}
}
return this.options.onlyLabels;
}
_getAnyOfLabels(issue) {
if (issue.isPullRequest) {
return this.options.anyOfPrLabels;
@ -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'),

View File

@ -27,7 +27,6 @@ describe('Issue', (): void => {
deleteBranch: false,
exemptIssueLabels: '',
exemptPrLabels: '',
onlyLabels: '',
onlyIssueLabels: '',
onlyPrLabels: '',
anyOfIssueLabels: '',

View File

@ -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.onlyLabels;
return this.options.onlyIssueLabels;
}
private _getAnyOfLabels(issue: Issue): string {

View File

@ -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',

View File

@ -18,7 +18,6 @@ export interface IIssuesProcessorOptions {
stalePrLabel: string;
closePrLabel: string;
exemptPrLabels: string;
onlyLabels: string;
onlyIssueLabels: string;
onlyPrLabels: string;
anyOfIssueLabels: string;

View File

@ -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'),