Add exemption for processing draft PRs

This commit is contained in:
Ross Brodbeck 2020-08-28 13:58:11 -04:00
parent 23eab295e2
commit 5e528060cc
3 changed files with 12 additions and 1 deletions

View File

@ -52,6 +52,9 @@ inputs:
skip-stale-issue-message:
description: 'Skip adding stale message when marking an issue as stale.'
default: false
process-drafts:
description: 'Should the draft PRs be marked stale? If set to true, draft PRs will be included in processing.'
default: false
runs:
using: 'node12'
main: 'dist/index.js'

View File

@ -10,6 +10,7 @@ export interface Issue {
pull_request: any;
state: string;
locked: boolean;
draft: boolean;
}
export interface User {
@ -50,6 +51,7 @@ export interface IssueProcessorOptions {
ascending: boolean;
skipStaleIssueMessage: boolean;
skipStalePrMessage: boolean;
processDrafts: boolean;
}
/***
@ -150,6 +152,11 @@ export class IssueProcessor {
continue; // don't process locked issues
}
if (issue.draft && !this.options.processDrafts) {
core.info(`Skipping ${issueType} because it is a draft`);
continue; // don't process drafts
}
if (
exemptLabels.some((exemptLabel: string) =>
IssueProcessor.isLabeled(issue, exemptLabel)

View File

@ -40,7 +40,8 @@ function getAndValidateArgs(): IssueProcessorOptions {
debugOnly: core.getInput('debug-only') === 'true',
ascending: core.getInput('ascending') === 'true',
skipStalePrMessage: core.getInput('skip-stale-pr-message') === 'true',
skipStaleIssueMessage: core.getInput('skip-stale-issue-message') === 'true'
skipStaleIssueMessage: core.getInput('skip-stale-issue-message') === 'true',
processDrafts: core.getInput('process-drafts') === 'true'
};
for (const numberInput of [