Merge pull request #3 from actions/optional-pr

Fix pr message to be optional
This commit is contained in:
Shawn Napora 2019-08-07 09:32:33 -04:00 committed by GitHub
commit 27d7ba7378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -48,7 +48,13 @@ async function processIssues(
for (var issue of issues.data.values()) {
core.debug(`found issue: ${issue.title} last updated ${issue.updated_at}`);
let isPr = !!issue.pull_request;
let staleMessage = isPr ? args.stalePrMessage : args.staleIssueMessage;
if (!staleMessage) {
core.debug(`skipping ${isPr ? "pr" : "issue"} due to empty message`);
continue;
}
let staleLabel = isPr ? args.stalePrLabel : args.staleIssueLabel;
if (isLabeledStale(issue, staleLabel)) {
@ -90,7 +96,6 @@ function wasLastUpdatedBefore(
const daysInMillis = 1000 * 60 * 60 * num_days;
const millisSinceLastUpdated =
new Date().getTime() - new Date(issue.updated_at).getTime();
core.debug(`${daysInMillis}, ${millisSinceLastUpdated}`);
return millisSinceLastUpdated >= daysInMillis;
}
@ -139,7 +144,7 @@ function getAndValidateArgs(): Args {
const args = {
repoToken: core.getInput('repo-token', {required: true}),
staleIssueMessage: core.getInput('stale-issue-message'),
stalePrMessage: core.getInput('stale-pr-message', {required: true}),
stalePrMessage: core.getInput('stale-pr-message'),
daysBeforeStale: parseInt(
core.getInput('days-before-stale', {required: true})
),