fix pr message to be optional

This commit is contained in:
Shawn Napora 2019-08-06 18:26:47 -04:00
parent 552417765d
commit 1aa89de5b1
1 changed files with 6 additions and 2 deletions

View File

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