Close stale issues even if they were just marked stale (#64)

This commit is contained in:
Ross Brodbeck
2020-05-11 11:15:05 -04:00
committed by GitHub
parent 1e900bc060
commit e611bf905b
3 changed files with 52 additions and 13 deletions

View File

@@ -150,20 +150,29 @@ export class IssueProcessor {
continue; // don't process exempt issues
}
if (IssueProcessor.isLabeled(issue, staleLabel)) {
core.debug(`Found a stale ${issueType}`);
await this.processStaleIssue(issue, issueType, staleLabel);
} else if (
// does this issue have a stale label?
let isStale = IssueProcessor.isLabeled(issue, staleLabel);
// determine if this issue needs to be marked stale first
if (
!isStale &&
!IssueProcessor.updatedSince(
issue.updated_at,
this.options.daysBeforeStale
)
) {
core.debug(
`Marking ${issueType} stale because it was last updated on ${issue.updated_at}`
`Marking ${issueType} stale because it was last updated on ${issue.updated_at} and it does not have a stale label`
);
await this.markStale(issue, staleMessage, staleLabel);
this.operationsLeft -= 2;
isStale = true; // this issue is now considered stale
}
// process any issues marked stale (including the issue above, if it was marked)
if (isStale) {
core.debug(`Found a stale ${issueType}`);
await this.processStaleIssue(issue, issueType, staleLabel);
}
}