feat: remove the exempt-all-milestones option
BREAKING CHANGE: The option exempt-all-milestones was removed
This commit is contained in:
parent
4665995b65
commit
315391885d
116
README.md
116
README.md
|
@ -28,55 +28,54 @@ 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 | |
|
||||||
| [days-before-pr-stale](#days-before-pr-stale) | Override [days-before-stale](#days-before-stale) for PRs only | |
|
| [days-before-pr-stale](#days-before-pr-stale) | Override [days-before-stale](#days-before-stale) for PRs only | |
|
||||||
| [days-before-close](#days-before-close) | Idle number of days before closing stale issues/PRs | `7` |
|
| [days-before-close](#days-before-close) | Idle number of days before closing stale issues/PRs | `7` |
|
||||||
| [days-before-issue-close](#days-before-issue-close) | Override [days-before-close](#days-before-close) for issues only | |
|
| [days-before-issue-close](#days-before-issue-close) | Override [days-before-close](#days-before-close) for issues only | |
|
||||||
| [days-before-pr-close](#days-before-pr-close) | Override [days-before-close](#days-before-close) for PRs only | |
|
| [days-before-pr-close](#days-before-pr-close) | Override [days-before-close](#days-before-close) for PRs only | |
|
||||||
| [stale-issue-message](#stale-issue-message) | Comment on the staled issues | |
|
| [stale-issue-message](#stale-issue-message) | Comment on the staled issues | |
|
||||||
| [stale-pr-message](#stale-pr-message) | Comment on the staled PRs | |
|
| [stale-pr-message](#stale-pr-message) | Comment on the staled PRs | |
|
||||||
| [close-issue-message](#close-issue-message) | Comment on the staled issues while closed | |
|
| [close-issue-message](#close-issue-message) | Comment on the staled issues while closed | |
|
||||||
| [close-pr-message](#close-pr-message) | Comment on the staled PRs while closed | |
|
| [close-pr-message](#close-pr-message) | Comment on the staled PRs while closed | |
|
||||||
| [stale-issue-label](#stale-issue-label) | Label to apply on staled issues | `Stale` |
|
| [stale-issue-label](#stale-issue-label) | Label to apply on staled issues | `Stale` |
|
||||||
| [close-issue-label](#close-issue-label) | Label to apply on closed issues | |
|
| [close-issue-label](#close-issue-label) | Label to apply on closed issues | |
|
||||||
| [stale-pr-label](#stale-pr-label) | Label to apply on staled PRs | `Stale` |
|
| [stale-pr-label](#stale-pr-label) | Label to apply on staled PRs | `Stale` |
|
||||||
| [close-pr-label](#close-pr-label) | Label to apply on closed PRs | |
|
| [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-issue-labels](#exempt-issue-labels) | Labels on issues exempted from stale | |
|
||||||
| [exempt-pr-labels](#exempt-pr-labels) | Labels on PRs 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-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-labels](#any-of-labels) | Only issues/PRs 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-issue-labels](#any-of-issue-labels) | Override [any-of-labels](#any-of-labels) for issues only | |
|
||||||
| [any-of-pr-labels](#any-of-pr-labels) | Override [any-of-labels](#any-of-labels) for PRs only | |
|
| [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 | |
|
||||||
| [remove-pr-stale-when-updated](#remove-pr-stale-when-updated) | Remove stale label from PRs on updates/comments | |
|
| [remove-pr-stale-when-updated](#remove-pr-stale-when-updated) | Remove stale label from PRs on updates/comments | |
|
||||||
| [labels-to-add-when-unstale](#labels-to-add-when-unstale) | Add specified labels from issues/PRs when they become unstale | |
|
| [labels-to-add-when-unstale](#labels-to-add-when-unstale) | Add specified labels from issues/PRs when they become unstale | |
|
||||||
| [labels-to-remove-when-unstale](#labels-to-remove-when-unstale) | Remove specified labels from issues/PRs when they become unstale | |
|
| [labels-to-remove-when-unstale](#labels-to-remove-when-unstale) | Remove specified labels from issues/PRs when they become unstale | |
|
||||||
| [debug-only](#debug-only) | Dry-run | `false` |
|
| [debug-only](#debug-only) | Dry-run | `false` |
|
||||||
| [ascending](#ascending) | Order to get issues/PRs | `false` |
|
| [ascending](#ascending) | Order to get issues/PRs | `false` |
|
||||||
| [start-date](#start-date) | Skip stale action for issues/PRs created before it | |
|
| [start-date](#start-date) | Skip stale action for issues/PRs created before it | |
|
||||||
| [delete-branch](#delete-branch) | Delete branch after closing a stale PR | `false` |
|
| [delete-branch](#delete-branch) | Delete branch after closing a stale PR | `false` |
|
||||||
| [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` |
|
| [exempt-all-pr-assignees](#exempt-all-pr-assignees) | Exempt all PRs with assignees from stale | `false` |
|
||||||
| [exempt-all-pr-assignees](#exempt-all-pr-assignees) | Exempt all PRs with assignees from stale | `false` |
|
| [exempt-draft-pr](#exempt-draft-pr) | Skip the stale action for draft PRs | `false` |
|
||||||
| [exempt-draft-pr](#exempt-draft-pr) | Skip the stale action for draft PRs | `false` |
|
| [enable-statistics](#enable-statistics) | Display statistics in the logs | `true` |
|
||||||
| [enable-statistics](#enable-statistics) | Display statistics in the logs | `true` |
|
| [ignore-issue-updates](#ignore-issue-updates) | Any update (update/comment) can reset the stale idle time on the issues | `false` |
|
||||||
| [ignore-issue-updates](#ignore-issue-updates) | Any update (update/comment) can reset the stale idle time on the issues | `false` |
|
| [ignore-pr-updates](#ignore-pr-updates) | Any update (update/comment) can reset the stale idle time on the PRs | `false` |
|
||||||
| [ignore-pr-updates](#ignore-pr-updates) | Any update (update/comment) can reset the stale idle time on the PRs | `false` |
|
|
||||||
|
|
||||||
### List of output options
|
### List of output options
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
12
action.yml
12
action.yml
|
@ -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.'
|
||||||
|
|
|
@ -1315,36 +1315,20 @@ 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',
|
||||||
|
|
|
@ -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,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,297 +1,273 @@
|
||||||
import deburr from 'lodash.deburr';
|
import deburr from 'lodash.deburr';
|
||||||
import {Option} from '../enums/option';
|
import {Option} from '../enums/option';
|
||||||
import {wordsToList} from '../functions/words-to-list';
|
import {wordsToList} from '../functions/words-to-list';
|
||||||
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||||
import {Issue} from './issue';
|
import {Issue} from './issue';
|
||||||
import {IssueLogger} from './loggers/issue-logger';
|
import {IssueLogger} from './loggers/issue-logger';
|
||||||
import {LoggerService} from '../services/logger.service';
|
import {LoggerService} from '../services/logger.service';
|
||||||
|
|
||||||
type CleanMilestone = string;
|
type CleanMilestone = string;
|
||||||
|
|
||||||
export class Milestones {
|
export class Milestones {
|
||||||
private static _cleanMilestone(milestone: Readonly<string>): CleanMilestone {
|
private static _cleanMilestone(milestone: Readonly<string>): CleanMilestone {
|
||||||
return deburr(milestone.toLowerCase());
|
return deburr(milestone.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly _options: IIssuesProcessorOptions;
|
private readonly _options: IIssuesProcessorOptions;
|
||||||
private readonly _issue: Issue;
|
private readonly _issue: Issue;
|
||||||
private readonly _issueLogger: IssueLogger;
|
private readonly _issueLogger: IssueLogger;
|
||||||
|
|
||||||
constructor(options: Readonly<IIssuesProcessorOptions>, issue: Issue) {
|
constructor(options: Readonly<IIssuesProcessorOptions>, issue: Issue) {
|
||||||
this._options = options;
|
this._options = options;
|
||||||
this._issue = issue;
|
this._issue = issue;
|
||||||
this._issueLogger = new IssueLogger(issue);
|
this._issueLogger = new IssueLogger(issue);
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldExemptMilestones(): boolean {
|
shouldExemptMilestones(): boolean {
|
||||||
if (!this._issue.milestone) {
|
if (!this._issue.milestone) {
|
||||||
this._issueLogger.info('This $$type has no milestone');
|
this._issueLogger.info('This $$type has no milestone');
|
||||||
this._logSkip();
|
this._logSkip();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._shouldExemptAllMilestones()) {
|
if (this._shouldExemptAllMilestones()) {
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('└──'),
|
LoggerService.white('└──'),
|
||||||
'Skipping this $$type because it has a milestone'
|
'Skipping this $$type because it has a milestone'
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const exemptMilestones: string[] = this._getExemptMilestones();
|
const exemptMilestones: string[] = this._getExemptMilestones();
|
||||||
|
|
||||||
if (exemptMilestones.length === 0) {
|
if (exemptMilestones.length === 0) {
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('├──'),
|
LoggerService.white('├──'),
|
||||||
`No milestone option was specified to skip the stale process for this $$type`
|
`No milestone option was specified to skip the stale process for this $$type`
|
||||||
);
|
);
|
||||||
this._logSkip();
|
this._logSkip();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('├──'),
|
LoggerService.white('├──'),
|
||||||
`Found ${LoggerService.cyan(exemptMilestones.length)} milestone${
|
`Found ${LoggerService.cyan(exemptMilestones.length)} milestone${
|
||||||
exemptMilestones.length > 1 ? 's' : ''
|
exemptMilestones.length > 1 ? 's' : ''
|
||||||
} that can exempt stale on this $$type`
|
} that can exempt stale on this $$type`
|
||||||
);
|
);
|
||||||
|
|
||||||
const hasExemptMilestone: boolean = exemptMilestones.some(
|
const hasExemptMilestone: boolean = exemptMilestones.some(
|
||||||
(exemptMilestone: Readonly<string>): boolean =>
|
(exemptMilestone: Readonly<string>): boolean =>
|
||||||
this._hasMilestone(exemptMilestone)
|
this._hasMilestone(exemptMilestone)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!hasExemptMilestone) {
|
if (!hasExemptMilestone) {
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('├──'),
|
LoggerService.white('├──'),
|
||||||
'No milestone on this $$type can exempt the stale process'
|
'No milestone on this $$type can exempt the stale process'
|
||||||
);
|
);
|
||||||
this._logSkip();
|
this._logSkip();
|
||||||
} else {
|
} else {
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('└──'),
|
LoggerService.white('└──'),
|
||||||
'Skipping this $$type because it has an exempt milestone'
|
'Skipping this $$type because it has an exempt milestone'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasExemptMilestone;
|
return hasExemptMilestone;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getExemptMilestones(): string[] {
|
private _getExemptMilestones(): string[] {
|
||||||
return this._issue.isPullRequest
|
return this._issue.isPullRequest
|
||||||
? this._getExemptPullRequestMilestones()
|
? this._getExemptPullRequestMilestones()
|
||||||
: this._getExemptIssueMilestones();
|
: this._getExemptIssueMilestones();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getExemptIssueMilestones(): string[] {
|
private _getExemptIssueMilestones(): string[] {
|
||||||
if (this._options.exemptIssueMilestones === '') {
|
if (this._options.exemptIssueMilestones === '') {
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('├──'),
|
LoggerService.white('├──'),
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
Option.ExemptIssueMilestones
|
Option.ExemptIssueMilestones
|
||||||
)} is disabled. No specific milestone can skip the stale process for this $$type`
|
)} is disabled. No specific milestone can skip the stale process for this $$type`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this._options.exemptMilestones === '') {
|
if (this._options.exemptMilestones === '') {
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('├──'),
|
LoggerService.white('├──'),
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
Option.ExemptMilestones
|
Option.ExemptMilestones
|
||||||
)} is disabled. No specific milestone can skip the stale process for this $$type`
|
)} is disabled. No specific milestone can skip the stale process for this $$type`
|
||||||
);
|
);
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const exemptMilestones: string[] = wordsToList(
|
const exemptMilestones: string[] = wordsToList(
|
||||||
this._options.exemptMilestones
|
this._options.exemptMilestones
|
||||||
);
|
);
|
||||||
|
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('├──'),
|
LoggerService.white('├──'),
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
Option.ExemptMilestones
|
Option.ExemptMilestones
|
||||||
)} is set. ${LoggerService.cyan(exemptMilestones.length)} milestone${
|
)} is set. ${LoggerService.cyan(exemptMilestones.length)} milestone${
|
||||||
exemptMilestones.length === 1 ? '' : 's'
|
exemptMilestones.length === 1 ? '' : 's'
|
||||||
} can skip the stale process for this $$type`
|
} can skip the stale process for this $$type`
|
||||||
);
|
);
|
||||||
|
|
||||||
return exemptMilestones;
|
return exemptMilestones;
|
||||||
}
|
}
|
||||||
|
|
||||||
const exemptMilestones: string[] = wordsToList(
|
const exemptMilestones: string[] = wordsToList(
|
||||||
this._options.exemptIssueMilestones
|
this._options.exemptIssueMilestones
|
||||||
);
|
);
|
||||||
|
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('├──'),
|
LoggerService.white('├──'),
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
Option.ExemptIssueMilestones
|
Option.ExemptIssueMilestones
|
||||||
)} is set. ${LoggerService.cyan(exemptMilestones.length)} milestone${
|
)} is set. ${LoggerService.cyan(exemptMilestones.length)} milestone${
|
||||||
exemptMilestones.length === 1 ? '' : 's'
|
exemptMilestones.length === 1 ? '' : 's'
|
||||||
} can skip the stale process for this $$type`
|
} can skip the stale process for this $$type`
|
||||||
);
|
);
|
||||||
|
|
||||||
return exemptMilestones;
|
return exemptMilestones;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getExemptPullRequestMilestones(): string[] {
|
private _getExemptPullRequestMilestones(): string[] {
|
||||||
if (this._options.exemptPrMilestones === '') {
|
if (this._options.exemptPrMilestones === '') {
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('├──'),
|
LoggerService.white('├──'),
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
Option.ExemptPrMilestones
|
Option.ExemptPrMilestones
|
||||||
)} is disabled. No specific milestone can skip the stale process for this $$type`
|
)} is disabled. No specific milestone can skip the stale process for this $$type`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this._options.exemptMilestones === '') {
|
if (this._options.exemptMilestones === '') {
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('├──'),
|
LoggerService.white('├──'),
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
Option.ExemptMilestones
|
Option.ExemptMilestones
|
||||||
)} is disabled. No specific milestone can skip the stale process for this $$type`
|
)} is disabled. No specific milestone can skip the stale process for this $$type`
|
||||||
);
|
);
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const exemptMilestones: string[] = wordsToList(
|
const exemptMilestones: string[] = wordsToList(
|
||||||
this._options.exemptMilestones
|
this._options.exemptMilestones
|
||||||
);
|
);
|
||||||
|
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('├──'),
|
LoggerService.white('├──'),
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
Option.ExemptMilestones
|
Option.ExemptMilestones
|
||||||
)} is set. ${LoggerService.cyan(exemptMilestones.length)} milestone${
|
)} is set. ${LoggerService.cyan(exemptMilestones.length)} milestone${
|
||||||
exemptMilestones.length === 1 ? '' : 's'
|
exemptMilestones.length === 1 ? '' : 's'
|
||||||
} can skip the stale process for this $$type`
|
} can skip the stale process for this $$type`
|
||||||
);
|
);
|
||||||
|
|
||||||
return exemptMilestones;
|
return exemptMilestones;
|
||||||
}
|
}
|
||||||
|
|
||||||
const exemptMilestones: string[] = wordsToList(
|
const exemptMilestones: string[] = wordsToList(
|
||||||
this._options.exemptPrMilestones
|
this._options.exemptPrMilestones
|
||||||
);
|
);
|
||||||
|
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('├──'),
|
LoggerService.white('├──'),
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
Option.ExemptPrMilestones
|
Option.ExemptPrMilestones
|
||||||
)} is set. ${LoggerService.cyan(exemptMilestones.length)} milestone${
|
)} is set. ${LoggerService.cyan(exemptMilestones.length)} milestone${
|
||||||
exemptMilestones.length === 1 ? '' : 's'
|
exemptMilestones.length === 1 ? '' : 's'
|
||||||
} can skip the stale process for this $$type`
|
} can skip the stale process for this $$type`
|
||||||
);
|
);
|
||||||
|
|
||||||
return exemptMilestones;
|
return exemptMilestones;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _hasMilestone(milestone: Readonly<string>): boolean {
|
private _hasMilestone(milestone: Readonly<string>): boolean {
|
||||||
if (!this._issue.milestone) {
|
if (!this._issue.milestone) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cleanMilestone: CleanMilestone =
|
const cleanMilestone: CleanMilestone =
|
||||||
Milestones._cleanMilestone(milestone);
|
Milestones._cleanMilestone(milestone);
|
||||||
|
|
||||||
const isSameMilestone: boolean =
|
const isSameMilestone: boolean =
|
||||||
cleanMilestone ===
|
cleanMilestone ===
|
||||||
Milestones._cleanMilestone(this._issue.milestone.title);
|
Milestones._cleanMilestone(this._issue.milestone.title);
|
||||||
|
|
||||||
if (isSameMilestone) {
|
if (isSameMilestone) {
|
||||||
this._issueLogger.info(
|
this._issueLogger.info(
|
||||||
LoggerService.white('├──'),
|
LoggerService.white('├──'),
|
||||||
`The milestone "${LoggerService.cyan(
|
`The milestone "${LoggerService.cyan(
|
||||||
milestone
|
milestone
|
||||||
)}" is set on this $$type and is an exempt milestone`
|
)}" is set on this $$type and is an exempt milestone`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return isSameMilestone;
|
return isSameMilestone;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _shouldExemptAllMilestones(): boolean {
|
private _shouldExemptAllMilestones(): boolean {
|
||||||
if (this._issue.milestone) {
|
if (this._issue.milestone) {
|
||||||
return this._issue.isPullRequest
|
return this._issue.isPullRequest
|
||||||
? this._shouldExemptAllPullRequestMilestones()
|
? this._shouldExemptAllPullRequestMilestones()
|
||||||
: this._shouldExemptAllIssueMilestones();
|
: this._shouldExemptAllIssueMilestones();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
)} is enabled. Any milestone on this $$type will skip the stale process`
|
)} 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(
|
this._issueLogger.info(
|
||||||
Option.ExemptAllIssueMilestones
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
)} is disabled. Only some specific milestones on this $$type will skip the stale process`
|
Option.ExemptAllIssueMilestones
|
||||||
);
|
)} is disabled. Only some specific milestones on this $$type will skip the stale process`
|
||||||
|
);
|
||||||
return false;
|
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
this._logExemptAllMilestonesOption();
|
|
||||||
|
private _shouldExemptAllPullRequestMilestones(): boolean {
|
||||||
return this._options.exemptAllMilestones;
|
if (this._options.exemptAllPrMilestones) {
|
||||||
}
|
this._issueLogger.info(
|
||||||
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
private _shouldExemptAllPullRequestMilestones(): boolean {
|
Option.ExemptAllPrMilestones
|
||||||
if (this._options.exemptAllPrMilestones === true) {
|
)} is enabled. Any milestone on this $$type will skip the stale process`
|
||||||
this._issueLogger.info(
|
);
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
|
||||||
Option.ExemptAllPrMilestones
|
return true;
|
||||||
)} is enabled. Any milestone on this $$type will skip the stale process`
|
}
|
||||||
);
|
|
||||||
|
this._issueLogger.info(
|
||||||
return true;
|
`The option ${this._issueLogger.createOptionLink(
|
||||||
} else if (this._options.exemptAllPrMilestones === false) {
|
Option.ExemptAllPrMilestones
|
||||||
this._issueLogger.info(
|
)} is disabled. Only some specific milestones on this $$type will skip the stale process`
|
||||||
`The option ${this._issueLogger.createOptionLink(
|
);
|
||||||
Option.ExemptAllPrMilestones
|
|
||||||
)} is disabled. Only some specific milestones on this $$type will skip the stale process`
|
return false;
|
||||||
);
|
}
|
||||||
|
|
||||||
return false;
|
private _logSkip(): void {
|
||||||
}
|
this._issueLogger.info(
|
||||||
|
LoggerService.white('└──'),
|
||||||
this._logExemptAllMilestonesOption();
|
'Skip the milestones checks'
|
||||||
|
);
|
||||||
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 {
|
|
||||||
this._issueLogger.info(
|
|
||||||
LoggerService.white('└──'),
|
|
||||||
'Skip the milestones checks'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue