Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to not close stale issues/prs #16

Merged
merged 2 commits into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inputs:
description: 'The number of days old an issue can be before marking it stale'
default: 60
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
stale-issue-label:
description: 'The label to apply when an issue is stale'
Expand Down
11 changes: 8 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,16 @@ async function processIssues(
if (exemptLabel && isLabeled(issue, exemptLabel)) {
continue;
} else if (isLabeled(issue, staleLabel)) {
if (wasLastUpdatedBefore(issue, args.daysBeforeClose)) {
operationsLeft -= await closeIssue(client, issue);
} else {
if (args.daysBeforeClose < 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could do:

if (args.daysBeforeClose >= 0 && wasLastUpdatedBefore(issue, args.daysBeforeClose)) {
  operationsLeft -= await closeIssue(client, issue);
} else {
  continue;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's cleaner

continue;
}
else {
if (wasLastUpdatedBefore(issue, args.daysBeforeClose)) {
operationsLeft -= await closeIssue(client, issue);
} else {
continue;
}
}
} else if (wasLastUpdatedBefore(issue, args.daysBeforeStale)) {
operationsLeft -= await markStale(
client,
Expand Down