Compare commits

...

5 Commits

Author SHA1 Message Date
Ross Brodbeck dcf19effbe update logging 2020-08-28 14:22:14 -04:00
Ross Brodbeck 2392a086f1 more logging to see if we have draft results 2020-08-28 14:19:19 -04:00
Ross Brodbeck c52e87c95b add some logging 2020-08-28 14:13:35 -04:00
Ross Brodbeck 990266dda6 Add dist file 2020-08-28 14:01:16 -04:00
Ross Brodbeck 5e528060cc Add exemption for processing draft PRs 2020-08-28 13:58:11 -04:00
4 changed files with 21 additions and 2 deletions

View File

@ -52,6 +52,9 @@ inputs:
skip-stale-issue-message: skip-stale-issue-message:
description: 'Skip adding stale message when marking an issue as stale.' description: 'Skip adding stale message when marking an issue as stale.'
default: false 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: runs:
using: 'node12' using: 'node12'
main: 'dist/index.js' main: 'dist/index.js'

8
dist/index.js vendored
View File

@ -1464,7 +1464,8 @@ function getAndValidateArgs() {
debugOnly: core.getInput('debug-only') === 'true', debugOnly: core.getInput('debug-only') === 'true',
ascending: core.getInput('ascending') === 'true', ascending: core.getInput('ascending') === 'true',
skipStalePrMessage: core.getInput('skip-stale-pr-message') === '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 [ for (const numberInput of [
'days-before-stale', 'days-before-stale',
@ -2606,6 +2607,10 @@ class IssueProcessor {
core.info(`Skipping ${issueType} because it is locked`); core.info(`Skipping ${issueType} because it is locked`);
continue; // don't process locked issues 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) => IssueProcessor.isLabeled(issue, exemptLabel))) { if (exemptLabels.some((exemptLabel) => IssueProcessor.isLabeled(issue, exemptLabel))) {
core.info(`Skipping ${issueType} because it has an exempt label`); core.info(`Skipping ${issueType} because it has an exempt label`);
continue; // don't process exempt issues continue; // don't process exempt issues
@ -2710,6 +2715,7 @@ class IssueProcessor {
direction: this.options.ascending ? 'asc' : 'desc', direction: this.options.ascending ? 'asc' : 'desc',
page page
}); });
core.info(`issue data: ${JSON.stringify(issueResult.data)}`);
return issueResult.data; return issueResult.data;
} }
catch (error) { catch (error) {

View File

@ -10,6 +10,7 @@ export interface Issue {
pull_request: any; pull_request: any;
state: string; state: string;
locked: boolean; locked: boolean;
draft: boolean;
} }
export interface User { export interface User {
@ -50,6 +51,7 @@ export interface IssueProcessorOptions {
ascending: boolean; ascending: boolean;
skipStaleIssueMessage: boolean; skipStaleIssueMessage: boolean;
skipStalePrMessage: boolean; skipStalePrMessage: boolean;
processDrafts: boolean;
} }
/*** /***
@ -150,6 +152,11 @@ export class IssueProcessor {
continue; // don't process locked issues 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 ( if (
exemptLabels.some((exemptLabel: string) => exemptLabels.some((exemptLabel: string) =>
IssueProcessor.isLabeled(issue, exemptLabel) IssueProcessor.isLabeled(issue, exemptLabel)
@ -315,6 +322,8 @@ export class IssueProcessor {
page page
} }
); );
core.info(`issue data: ${JSON.stringify(issueResult.data)}`);
return issueResult.data; return issueResult.data;
} catch (error) { } catch (error) {
core.error(`Get issues for repo error: ${error.message}`); core.error(`Get issues for repo error: ${error.message}`);

View File

@ -40,7 +40,8 @@ function getAndValidateArgs(): IssueProcessorOptions {
debugOnly: core.getInput('debug-only') === 'true', debugOnly: core.getInput('debug-only') === 'true',
ascending: core.getInput('ascending') === 'true', ascending: core.getInput('ascending') === 'true',
skipStalePrMessage: core.getInput('skip-stale-pr-message') === '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 [ for (const numberInput of [