feat: remove the exempt-all-milestones option

BREAKING CHANGE:
The option exempt-all-milestones was removed
This commit is contained in:
TESTELIN Geoffrey 2021-10-08 19:19:07 +02:00
parent 4665995b65
commit 315391885d
No known key found for this signature in database
GPG Key ID: 05D28E8D8E8E52DA
11 changed files with 1752 additions and 4146 deletions

View File

@ -29,7 +29,7 @@ You can find more information about the required permissions under the correspon
Every argument is optional. Every argument is optional.
| Input | Description | Default | | Input | Description | Default |
| ------------------------------------------------------------------- | ------------------------------------------------------------------------ | --------------------- | | ------------------------------------------------------------------- | ----------------------------------------------------------------------- | --------------------- | ------- |
| [repo-token](#repo-token) | PAT for GitHub API authentication | `${{ github.token }}` | | [repo-token](#repo-token) | PAT for GitHub API authentication | `${{ github.token }}` |
| [days-before-stale](#days-before-stale) | Idle number of days before marking issues/PRs stale | `60` | | [days-before-stale](#days-before-stale) | Idle number of days before marking issues/PRs stale | `60` |
| [days-before-issue-stale](#days-before-issue-stale) | Override [days-before-stale](#days-before-stale) for issues only | | | [days-before-issue-stale](#days-before-issue-stale) | Override [days-before-stale](#days-before-stale) for issues only | |
@ -66,9 +66,8 @@ Every argument is optional.
| [exempt-milestones](#exempt-milestones) | Milestones on issues/PRs exempted from stale | | | [exempt-milestones](#exempt-milestones) | Milestones on issues/PRs exempted from stale | |
| [exempt-issue-milestones](#exempt-issue-milestones) | Override [exempt-milestones](#exempt-milestones) for issues only | | | [exempt-issue-milestones](#exempt-issue-milestones) | Override [exempt-milestones](#exempt-milestones) for issues only | |
| [exempt-pr-milestones](#exempt-pr-milestones) | Override [exempt-milestones](#exempt-milestones) for PRs only | | | [exempt-pr-milestones](#exempt-pr-milestones) | Override [exempt-milestones](#exempt-milestones) for PRs only | |
| [exempt-all-milestones](#exempt-all-milestones) | Exempt all issues/PRs with milestones from stale | `false` | | [exempt-all-issue-milestones](#exempt-all-issue-milestones) | Exempt all issues with milestones from stale | | `false` |
| [exempt-all-issue-milestones](#exempt-all-issue-milestones) | Override [exempt-all-milestones](#exempt-all-milestones) for issues only | | | [exempt-all-pr-milestones](#exempt-all-pr-milestones) | Exempt all PRs with milestones from stale | | `false` |
| [exempt-all-pr-milestones](#exempt-all-pr-milestones) | Override [exempt-all-milestones](#exempt-all-milestones) for PRs only | |
| [exempt-issue-assignees](#exempt-issue-assignees) | Assignees on issues exempted from stale | | | [exempt-issue-assignees](#exempt-issue-assignees) | Assignees on issues exempted from stale | |
| [exempt-pr-assignees](#exempt-pr-assignees) | Assignees on PRs exempted from stale | | | [exempt-pr-assignees](#exempt-pr-assignees) | Assignees on PRs exempted from stale | |
| [exempt-all-issue-assignees](#exempt-all-issue-assignees) | Exempt all issues with assignees from stale | `false` | | [exempt-all-issue-assignees](#exempt-all-issue-assignees) | Exempt all issues with assignees from stale | `false` |
@ -122,7 +121,8 @@ You can fine tune which issues or pull requests should be marked as stale based
- [any-of-labels](#any-of-labels) - [any-of-labels](#any-of-labels)
- [start-date](#start-date) - [start-date](#start-date)
- [exempt-milestones](#exempt-milestones) - [exempt-milestones](#exempt-milestones)
- [exempt-all-milestones](#exempt-all-milestones) - [exempt-all-issue-milestones](#exempt-all-issue-milestones)
- [exempt-all-pr-milestones](#exempt-all-pr-milestones)
- [exempt-issue-assignees](#exempt-issue-assignees) - [exempt-issue-assignees](#exempt-issue-assignees)
- [exempt-pr-assignees](#exempt-pr-assignees) - [exempt-pr-assignees](#exempt-pr-assignees)
- [exempt-all-issue-assignees](#exempt-all-issue-assignees) - [exempt-all-issue-assignees](#exempt-all-issue-assignees)
@ -412,25 +412,21 @@ Override [exempt-milestones](#exempt-milestones) but only to process the pull re
Default value: unset Default value: unset
#### exempt-all-milestones #### exempt-all-issue-milestones
If set to `true`, the issues or the pull requests with a milestone will not be marked as stale automatically. If set to `true`, the issues with a milestone will not be marked as stale automatically.
Priority over [exempt-milestones](#exempt-milestones). Priority over [exempt-milestones](#exempt-milestones).
Default value: `false` Default value: `false`
#### exempt-all-issue-milestones
Override [exempt-all-milestones](#exempt-all-milestones) but only to exempt the issues with a milestone to be marked as stale automatically.
Default value: unset
#### exempt-all-pr-milestones #### exempt-all-pr-milestones
Override [exempt-all-milestones](#exempt-all-milestones) but only to exempt the pull requests with a milestone to be marked as stale automatically. If set to `true`, the pull requests with a milestone will not be marked as stale automatically.
Default value: unset Priority over [exempt-milestones](#exempt-milestones).
Default value: `false`
#### exempt-issue-assignees #### exempt-issue-assignees

View File

@ -35,9 +35,8 @@ export const DefaultProcessorOptions: IIssuesProcessorOptions = Object.freeze({
exemptMilestones: '', exemptMilestones: '',
exemptIssueMilestones: '', exemptIssueMilestones: '',
exemptPrMilestones: '', exemptPrMilestones: '',
exemptAllMilestones: false, exemptAllIssueMilestones: false,
exemptAllIssueMilestones: undefined, exemptAllPrMilestones: false,
exemptAllPrMilestones: undefined,
exemptAssignees: '', exemptAssignees: '',
exemptIssueAssignees: '', exemptIssueAssignees: '',
exemptPrAssignees: '', exemptPrAssignees: '',

File diff suppressed because it is too large Load Diff

View File

@ -72,17 +72,13 @@ inputs:
description: 'The milestones that mean a pull request is exempt from being marked as stale. Separate multiple milestones with commas (eg. "milestone1,milestone2"). Override "exempt-milestones" option regarding only the pull requests.' description: 'The milestones that mean a pull request is exempt from being marked as stale. Separate multiple milestones with commas (eg. "milestone1,milestone2"). Override "exempt-milestones" option regarding only the pull requests.'
default: '' default: ''
required: false required: false
exempt-all-milestones: exempt-all-issue-milestones:
description: 'Exempt all issues and pull requests with milestones from being marked as stale. Default to false.' description: 'Exempt all issues with milestones from being marked as stale. Default to false.'
default: 'false' default: 'false'
required: false required: false
exempt-all-issue-milestones:
description: 'Exempt all issues with milestones from being marked as stale. Override "exempt-all-milestones" option regarding only the issues.'
default: ''
required: false
exempt-all-pr-milestones: exempt-all-pr-milestones:
description: 'Exempt all pull requests with milestones from being marked as stale. Override "exempt-all-milestones" option regarding only the pull requests.' description: 'Exempt all pull requests with milestones from being marked as stale. Default to false.'
default: '' default: 'false'
required: false required: false
only-labels: 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.' 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.'

26
dist/index.js vendored
View File

@ -1315,37 +1315,21 @@ class Milestones {
return false; return false;
} }
_shouldExemptAllIssueMilestones() { _shouldExemptAllIssueMilestones() {
if (this._options.exemptAllIssueMilestones === true) { if (this._options.exemptAllIssueMilestones) {
this._issueLogger.info(`The option ${this._issueLogger.createOptionLink(option_1.Option.ExemptAllIssueMilestones)} is enabled. Any milestone on this $$type will skip the stale process`); this._issueLogger.info(`The option ${this._issueLogger.createOptionLink(option_1.Option.ExemptAllIssueMilestones)} is enabled. Any milestone on this $$type will skip the stale process`);
return true; return true;
} }
else if (this._options.exemptAllIssueMilestones === false) {
this._issueLogger.info(`The option ${this._issueLogger.createOptionLink(option_1.Option.ExemptAllIssueMilestones)} is disabled. Only some specific milestones on this $$type will skip the stale process`); this._issueLogger.info(`The option ${this._issueLogger.createOptionLink(option_1.Option.ExemptAllIssueMilestones)} is disabled. Only some specific milestones on this $$type will skip the stale process`);
return false; return false;
} }
this._logExemptAllMilestonesOption();
return this._options.exemptAllMilestones;
}
_shouldExemptAllPullRequestMilestones() { _shouldExemptAllPullRequestMilestones() {
if (this._options.exemptAllPrMilestones === true) { if (this._options.exemptAllPrMilestones) {
this._issueLogger.info(`The option ${this._issueLogger.createOptionLink(option_1.Option.ExemptAllPrMilestones)} is enabled. Any milestone on this $$type will skip the stale process`); this._issueLogger.info(`The option ${this._issueLogger.createOptionLink(option_1.Option.ExemptAllPrMilestones)} is enabled. Any milestone on this $$type will skip the stale process`);
return true; return true;
} }
else if (this._options.exemptAllPrMilestones === false) {
this._issueLogger.info(`The option ${this._issueLogger.createOptionLink(option_1.Option.ExemptAllPrMilestones)} is disabled. Only some specific milestones on this $$type will skip the stale process`); this._issueLogger.info(`The option ${this._issueLogger.createOptionLink(option_1.Option.ExemptAllPrMilestones)} is disabled. Only some specific milestones on this $$type will skip the stale process`);
return false; return false;
} }
this._logExemptAllMilestonesOption();
return this._options.exemptAllMilestones;
}
_logExemptAllMilestonesOption() {
if (this._options.exemptAllMilestones) {
this._issueLogger.info(`The option ${this._issueLogger.createOptionLink(option_1.Option.ExemptAllMilestones)} is enabled. Any milestone on this $$type will skip the stale process`);
}
else {
this._issueLogger.info(`The option ${this._issueLogger.createOptionLink(option_1.Option.ExemptAllMilestones)} is disabled. Only some specific milestones on this $$type will skip the stale process`);
}
}
_logSkip() { _logSkip() {
this._issueLogger.info(logger_service_1.LoggerService.white('└──'), 'Skip the milestones checks'); this._issueLogger.info(logger_service_1.LoggerService.white('└──'), 'Skip the milestones checks');
} }
@ -1814,7 +1798,6 @@ var Option;
Option["ExemptMilestones"] = "exempt-milestones"; Option["ExemptMilestones"] = "exempt-milestones";
Option["ExemptIssueMilestones"] = "exempt-issue-milestones"; Option["ExemptIssueMilestones"] = "exempt-issue-milestones";
Option["ExemptPrMilestones"] = "exempt-pr-milestones"; Option["ExemptPrMilestones"] = "exempt-pr-milestones";
Option["ExemptAllMilestones"] = "exempt-all-milestones";
Option["ExemptAllIssueMilestones"] = "exempt-all-issue-milestones"; Option["ExemptAllIssueMilestones"] = "exempt-all-issue-milestones";
Option["ExemptAllPrMilestones"] = "exempt-all-pr-milestones"; Option["ExemptAllPrMilestones"] = "exempt-all-pr-milestones";
Option["ExemptIssueAssignees"] = "exempt-issue-assignees"; Option["ExemptIssueAssignees"] = "exempt-issue-assignees";
@ -2122,9 +2105,8 @@ function _getAndValidateArgs() {
exemptMilestones: core.getInput('exempt-milestones'), exemptMilestones: core.getInput('exempt-milestones'),
exemptIssueMilestones: core.getInput('exempt-issue-milestones'), exemptIssueMilestones: core.getInput('exempt-issue-milestones'),
exemptPrMilestones: core.getInput('exempt-pr-milestones'), exemptPrMilestones: core.getInput('exempt-pr-milestones'),
exemptAllMilestones: core.getInput('exempt-all-milestones') === 'true', exemptAllIssueMilestones: core.getInput('exempt-all-issue-milestones') === 'true',
exemptAllIssueMilestones: _toOptionalBoolean('exempt-all-issue-milestones'), exemptAllPrMilestones: core.getInput('exempt-all-pr-milestones') === 'true',
exemptAllPrMilestones: _toOptionalBoolean('exempt-all-pr-milestones'),
exemptIssueAssignees: core.getInput('exempt-issue-assignees'), exemptIssueAssignees: core.getInput('exempt-issue-assignees'),
exemptPrAssignees: core.getInput('exempt-pr-assignees'), exemptPrAssignees: core.getInput('exempt-pr-assignees'),
exemptAllIssueAssignees: core.getInput('exempt-all-issue-assignees') === 'true', exemptAllIssueAssignees: core.getInput('exempt-all-issue-assignees') === 'true',

View File

@ -46,9 +46,8 @@ describe('Issue', (): void => {
exemptMilestones: '', exemptMilestones: '',
exemptIssueMilestones: '', exemptIssueMilestones: '',
exemptPrMilestones: '', exemptPrMilestones: '',
exemptAllMilestones: false, exemptAllIssueMilestones: false,
exemptAllIssueMilestones: undefined, exemptAllPrMilestones: false,
exemptAllPrMilestones: undefined,
exemptIssueAssignees: '', exemptIssueAssignees: '',
exemptPrAssignees: '', exemptPrAssignees: '',
exemptAllIssueAssignees: false, exemptAllIssueAssignees: false,

View File

@ -12,7 +12,11 @@ describe('Milestones', (): void => {
let issueInterface: IIssue; let issueInterface: IIssue;
beforeEach((): void => { beforeEach((): void => {
optionsInterface = {...DefaultProcessorOptions, exemptAllMilestones: false}; optionsInterface = {
...DefaultProcessorOptions,
exemptAllIssueAssignees: false,
exemptAllPrMilestones: false
};
issueInterface = generateIIssue(); issueInterface = generateIIssue();
}); });
@ -286,45 +290,6 @@ describe('Milestones', (): void => {
}); });
}); });
describe('when the given options are configured to exempt all milestones', (): void => {
beforeEach((): void => {
optionsInterface.exemptAllMilestones = true;
});
describe('when the given issue does not have a milestone', (): void => {
beforeEach((): void => {
issueInterface.milestone = undefined;
});
it('should return false', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
milestones = new Milestones(optionsInterface, issue);
const result = milestones.shouldExemptMilestones();
expect(result).toStrictEqual(false);
});
});
describe('when the given issue does have a milestone', (): void => {
beforeEach((): void => {
issueInterface.milestone = {
title: 'dummy-exempt-issue-milestone'
};
});
it('should return true', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
milestones = new Milestones(optionsInterface, issue);
const result = milestones.shouldExemptMilestones();
expect(result).toStrictEqual(true);
});
});
describe('when the given options are not configured to exempt all issue milestones', (): void => { describe('when the given options are not configured to exempt all issue milestones', (): void => {
beforeEach((): void => { beforeEach((): void => {
optionsInterface.exemptAllIssueMilestones = false; optionsInterface.exemptAllIssueMilestones = false;
@ -405,7 +370,6 @@ describe('Milestones', (): void => {
}); });
}); });
}); });
});
describe('when the given issue is a pull request', (): void => { describe('when the given issue is a pull request', (): void => {
beforeEach((): void => { beforeEach((): void => {
@ -674,45 +638,6 @@ describe('Milestones', (): void => {
}); });
}); });
describe('when the given options are configured to exempt all milestones', (): void => {
beforeEach((): void => {
optionsInterface.exemptAllMilestones = true;
});
describe('when the given pull request does not have a milestone', (): void => {
beforeEach((): void => {
issueInterface.milestone = undefined;
});
it('should return false', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
milestones = new Milestones(optionsInterface, issue);
const result = milestones.shouldExemptMilestones();
expect(result).toStrictEqual(false);
});
});
describe('when the given pull request does have a milestone', (): void => {
beforeEach((): void => {
issueInterface.milestone = {
title: 'dummy-exempt-pr-milestone'
};
});
it('should return true', (): void => {
expect.assertions(1);
issue = new Issue(optionsInterface, issueInterface);
milestones = new Milestones(optionsInterface, issue);
const result = milestones.shouldExemptMilestones();
expect(result).toStrictEqual(true);
});
});
describe('when the given options are not configured to exempt all pull request milestones', (): void => { describe('when the given options are not configured to exempt all pull request milestones', (): void => {
beforeEach((): void => { beforeEach((): void => {
optionsInterface.exemptAllPrMilestones = false; optionsInterface.exemptAllPrMilestones = false;
@ -794,5 +719,4 @@ describe('Milestones', (): void => {
}); });
}); });
}); });
});
}); });

View File

@ -225,7 +225,7 @@ export class Milestones {
} }
private _shouldExemptAllIssueMilestones(): boolean { private _shouldExemptAllIssueMilestones(): boolean {
if (this._options.exemptAllIssueMilestones === true) { if (this._options.exemptAllIssueMilestones) {
this._issueLogger.info( this._issueLogger.info(
`The option ${this._issueLogger.createOptionLink( `The option ${this._issueLogger.createOptionLink(
Option.ExemptAllIssueMilestones Option.ExemptAllIssueMilestones
@ -233,7 +233,8 @@ export class Milestones {
); );
return true; return true;
} else if (this._options.exemptAllIssueMilestones === false) { }
this._issueLogger.info( this._issueLogger.info(
`The option ${this._issueLogger.createOptionLink( `The option ${this._issueLogger.createOptionLink(
Option.ExemptAllIssueMilestones Option.ExemptAllIssueMilestones
@ -243,13 +244,8 @@ export class Milestones {
return false; return false;
} }
this._logExemptAllMilestonesOption();
return this._options.exemptAllMilestones;
}
private _shouldExemptAllPullRequestMilestones(): boolean { private _shouldExemptAllPullRequestMilestones(): boolean {
if (this._options.exemptAllPrMilestones === true) { if (this._options.exemptAllPrMilestones) {
this._issueLogger.info( this._issueLogger.info(
`The option ${this._issueLogger.createOptionLink( `The option ${this._issueLogger.createOptionLink(
Option.ExemptAllPrMilestones Option.ExemptAllPrMilestones
@ -257,7 +253,8 @@ export class Milestones {
); );
return true; return true;
} else if (this._options.exemptAllPrMilestones === false) { }
this._issueLogger.info( this._issueLogger.info(
`The option ${this._issueLogger.createOptionLink( `The option ${this._issueLogger.createOptionLink(
Option.ExemptAllPrMilestones Option.ExemptAllPrMilestones
@ -267,27 +264,6 @@ export class Milestones {
return false; return false;
} }
this._logExemptAllMilestonesOption();
return this._options.exemptAllMilestones;
}
private _logExemptAllMilestonesOption(): void {
if (this._options.exemptAllMilestones) {
this._issueLogger.info(
`The option ${this._issueLogger.createOptionLink(
Option.ExemptAllMilestones
)} is enabled. Any milestone on this $$type will skip the stale process`
);
} else {
this._issueLogger.info(
`The option ${this._issueLogger.createOptionLink(
Option.ExemptAllMilestones
)} is disabled. Only some specific milestones on this $$type will skip the stale process`
);
}
}
private _logSkip(): void { private _logSkip(): void {
this._issueLogger.info( this._issueLogger.info(
LoggerService.white('└──'), LoggerService.white('└──'),

View File

@ -31,7 +31,6 @@ export enum Option {
ExemptMilestones = 'exempt-milestones', ExemptMilestones = 'exempt-milestones',
ExemptIssueMilestones = 'exempt-issue-milestones', ExemptIssueMilestones = 'exempt-issue-milestones',
ExemptPrMilestones = 'exempt-pr-milestones', ExemptPrMilestones = 'exempt-pr-milestones',
ExemptAllMilestones = 'exempt-all-milestones',
ExemptAllIssueMilestones = 'exempt-all-issue-milestones', ExemptAllIssueMilestones = 'exempt-all-issue-milestones',
ExemptAllPrMilestones = 'exempt-all-pr-milestones', ExemptAllPrMilestones = 'exempt-all-pr-milestones',
ExemptIssueAssignees = 'exempt-issue-assignees', ExemptIssueAssignees = 'exempt-issue-assignees',

View File

@ -35,9 +35,8 @@ export interface IIssuesProcessorOptions {
exemptMilestones: string; exemptMilestones: string;
exemptIssueMilestones: string; exemptIssueMilestones: string;
exemptPrMilestones: string; exemptPrMilestones: string;
exemptAllMilestones: boolean; exemptAllIssueMilestones: boolean;
exemptAllIssueMilestones: boolean | undefined; exemptAllPrMilestones: boolean;
exemptAllPrMilestones: boolean | undefined;
exemptIssueAssignees: string; exemptIssueAssignees: string;
exemptPrAssignees: string; exemptPrAssignees: string;
exemptAllIssueAssignees: boolean; exemptAllIssueAssignees: boolean;

View File

@ -72,9 +72,9 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
exemptMilestones: core.getInput('exempt-milestones'), exemptMilestones: core.getInput('exempt-milestones'),
exemptIssueMilestones: core.getInput('exempt-issue-milestones'), exemptIssueMilestones: core.getInput('exempt-issue-milestones'),
exemptPrMilestones: core.getInput('exempt-pr-milestones'), exemptPrMilestones: core.getInput('exempt-pr-milestones'),
exemptAllMilestones: core.getInput('exempt-all-milestones') === 'true', exemptAllIssueMilestones:
exemptAllIssueMilestones: _toOptionalBoolean('exempt-all-issue-milestones'), core.getInput('exempt-all-issue-milestones') === 'true',
exemptAllPrMilestones: _toOptionalBoolean('exempt-all-pr-milestones'), exemptAllPrMilestones: core.getInput('exempt-all-pr-milestones') === 'true',
exemptIssueAssignees: core.getInput('exempt-issue-assignees'), exemptIssueAssignees: core.getInput('exempt-issue-assignees'),
exemptPrAssignees: core.getInput('exempt-pr-assignees'), exemptPrAssignees: core.getInput('exempt-pr-assignees'),
exemptAllIssueAssignees: exemptAllIssueAssignees: