mirror of
https://github.com/actions/stale.git
synced 2025-12-24 01:18:17 +00:00
* Ignore issues that have recent comments and ignore the stale label. Defaulting to this behavior but added an option to turn it off. * Fix up tests a bit to make this runnable. Add a test for the logic. * Add vscode debugging configuration.
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import * as core from '@actions/core';
|
|
import {IssueProcessor, IssueProcessorOptions} from './IssueProcessor';
|
|
|
|
async function run(): Promise<void> {
|
|
try {
|
|
const args = getAndValidateArgs();
|
|
|
|
const processor: IssueProcessor = new IssueProcessor(args);
|
|
await processor.processIssues();
|
|
} catch (error) {
|
|
core.error(error);
|
|
core.setFailed(error.message);
|
|
}
|
|
}
|
|
|
|
function getAndValidateArgs(): IssueProcessorOptions {
|
|
const args = {
|
|
repoToken: core.getInput('repo-token', {required: true}),
|
|
staleIssueMessage: core.getInput('stale-issue-message'),
|
|
stalePrMessage: core.getInput('stale-pr-message'),
|
|
daysBeforeStale: parseInt(
|
|
core.getInput('days-before-stale', {required: true})
|
|
),
|
|
daysBeforeClose: parseInt(
|
|
core.getInput('days-before-close', {required: true})
|
|
),
|
|
staleIssueLabel: core.getInput('stale-issue-label', {required: true}),
|
|
exemptIssueLabels: core.getInput('exempt-issue-labels'),
|
|
stalePrLabel: core.getInput('stale-pr-label', {required: true}),
|
|
exemptPrLabels: core.getInput('exempt-pr-labels'),
|
|
onlyLabels: core.getInput('only-labels'),
|
|
operationsPerRun: parseInt(
|
|
core.getInput('operations-per-run', {required: true})
|
|
),
|
|
removeStaleWhenUpdated: !(
|
|
core.getInput('remove-stale-when-updated') === 'false'
|
|
),
|
|
debugOnly: core.getInput('debug-only') === 'true'
|
|
};
|
|
|
|
for (const numberInput of [
|
|
'days-before-stale',
|
|
'days-before-close',
|
|
'operations-per-run'
|
|
]) {
|
|
if (isNaN(parseInt(core.getInput(numberInput)))) {
|
|
throw Error(`input ${numberInput} did not parse to a valid integer`);
|
|
}
|
|
}
|
|
|
|
return args;
|
|
}
|
|
|
|
run();
|