Add option to not close stale

This commit is contained in:
damccorm 2019-09-04 16:38:09 -04:00
parent 08796943dd
commit 2521dbb244
2 changed files with 9 additions and 4 deletions

View File

@ -13,7 +13,7 @@ inputs:
description: 'The number of days old an issue can be before marking it stale' description: 'The number of days old an issue can be before marking it stale'
default: 60 default: 60
days-before-close: days-before-close:
description: 'The number of days to wait to close an issue or pull request after it being marked stale' description: 'The number of days to wait to close an issue or pull request after it being marked stale. Set to -1 to never close stale issues.'
default: 7 default: 7
stale-issue-label: stale-issue-label:
description: 'The label to apply when an issue is stale' description: 'The label to apply when an issue is stale'

View File

@ -66,11 +66,16 @@ async function processIssues(
if (exemptLabel && isLabeled(issue, exemptLabel)) { if (exemptLabel && isLabeled(issue, exemptLabel)) {
continue; continue;
} else if (isLabeled(issue, staleLabel)) { } else if (isLabeled(issue, staleLabel)) {
if (wasLastUpdatedBefore(issue, args.daysBeforeClose)) { if (args.daysBeforeClose < 0) {
operationsLeft -= await closeIssue(client, issue);
} else {
continue; continue;
} }
else {
if (wasLastUpdatedBefore(issue, args.daysBeforeClose)) {
operationsLeft -= await closeIssue(client, issue);
} else {
continue;
}
}
} else if (wasLastUpdatedBefore(issue, args.daysBeforeStale)) { } else if (wasLastUpdatedBefore(issue, args.daysBeforeStale)) {
operationsLeft -= await markStale( operationsLeft -= await markStale(
client, client,