mirror of
https://github.com/actions/stale.git
synced 2025-12-12 13:07:28 +00:00
feat(milestones): add new options to exempt all milestones (#291)
* refactor: move and rename the interfaces/classes closes #272 * docs: update the readme and action to describe the new options for milestones * refactor: split the tests into multiple files * feat(milestones): add new options to exempt all milestones * test: add coverage for the default values * test(milestones): add more coverage (wip) * test(milestones): add more coverage for the multiple exempt milestones * test: reduce duplicated code * test: change some describes * test: add more coverage * test: add more coverage * test: add final coverage * build(tsc): add missing project flag to build with the right tsconfig * test(milestones): use each to reduce the complexity of the tests * chore: fix an eslint issue with prettier on windows the end of line was wrong each time the os process the files * docs: move the contribution section to a dedicated file add more content to help the debug * chore: make sure the rebase is ok
This commit is contained in:
committed by
GitHub
parent
07f3f88b6d
commit
6a493760cf
27
src/main.ts
27
src/main.ts
@@ -3,9 +3,9 @@ import {isValidDate} from './functions/dates/is-valid-date';
|
||||
import {IssuesProcessor} from './classes/issues-processor';
|
||||
import {IIssuesProcessorOptions} from './interfaces/issues-processor-options';
|
||||
|
||||
async function run(): Promise<void> {
|
||||
async function _run(): Promise<void> {
|
||||
try {
|
||||
const args = getAndValidateArgs();
|
||||
const args = _getAndValidateArgs();
|
||||
|
||||
const processor: IssuesProcessor = new IssuesProcessor(args);
|
||||
await processor.processIssues();
|
||||
@@ -15,7 +15,7 @@ async function run(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
function getAndValidateArgs(): IIssuesProcessorOptions {
|
||||
function _getAndValidateArgs(): IIssuesProcessorOptions {
|
||||
const args: IIssuesProcessorOptions = {
|
||||
repoToken: core.getInput('repo-token'),
|
||||
staleIssueMessage: core.getInput('stale-issue-message'),
|
||||
@@ -56,7 +56,10 @@ function getAndValidateArgs(): IIssuesProcessorOptions {
|
||||
: undefined,
|
||||
exemptMilestones: core.getInput('exempt-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: _toOptionalBoolean('exempt-all-issue-milestones'),
|
||||
exemptAllPrMilestones: _toOptionalBoolean('exempt-all-pr-milestones')
|
||||
};
|
||||
|
||||
for (const numberInput of [
|
||||
@@ -83,4 +86,18 @@ function getAndValidateArgs(): IIssuesProcessorOptions {
|
||||
return args;
|
||||
}
|
||||
|
||||
run();
|
||||
function _toOptionalBoolean(
|
||||
argumentName: Readonly<string>
|
||||
): boolean | undefined {
|
||||
const argument: string = core.getInput(argumentName);
|
||||
|
||||
if (argument === 'true') {
|
||||
return true;
|
||||
} else if (argument === 'false') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
_run();
|
||||
|
||||
Reference in New Issue
Block a user