Merge pull request #3 from actions/optional-pr
Fix pr message to be optional
This commit is contained in:
commit
27d7ba7378
|
@ -48,7 +48,13 @@ 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) {
|
||||||
|
core.debug(`skipping ${isPr ? "pr" : "issue"} due to empty message`);
|
||||||
|
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 +96,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 +144,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})
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue