Merge pull request #22 from yuya-takeyama/only-labels-pr

Add only-labels option
This commit is contained in:
Ross Brodbeck 2020-04-13 07:19:13 -04:00 committed by GitHub
commit 3d5d474504
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,9 @@ inputs:
default: 'Stale' default: 'Stale'
exempt-pr-label: exempt-pr-label:
description: 'The label to apply when a pull request is exempt from being marked stale' description: 'The label to apply when a pull request is exempt from being marked stale'
only-labels:
description: 'Only issues or pull requests with all of these labels are checked if stale. Defaults to `[]` (disabled)' and can be a comma-separated list of labels
default: ''
operations-per-run: operations-per-run:
description: 'The maximum number of operations per run, used to control rate limiting' description: 'The maximum number of operations per run, used to control rate limiting'
default: 30 default: 30

View File

@ -15,6 +15,7 @@ type Args = {
exemptIssueLabel: string; exemptIssueLabel: string;
stalePrLabel: string; stalePrLabel: string;
exemptPrLabel: string; exemptPrLabel: string;
onlyLabels: string;
operationsPerRun: number; operationsPerRun: number;
}; };
@ -40,6 +41,7 @@ async function processIssues(
owner: github.context.repo.owner, owner: github.context.repo.owner,
repo: github.context.repo.repo, repo: github.context.repo.repo,
state: 'open', state: 'open',
labels: args.onlyLabels,
per_page: 100, per_page: 100,
page: page page: page
}); });
@ -159,6 +161,7 @@ function getAndValidateArgs(): Args {
exemptIssueLabel: core.getInput('exempt-issue-label'), exemptIssueLabel: core.getInput('exempt-issue-label'),
stalePrLabel: core.getInput('stale-pr-label', {required: true}), stalePrLabel: core.getInput('stale-pr-label', {required: true}),
exemptPrLabel: core.getInput('exempt-pr-label'), exemptPrLabel: core.getInput('exempt-pr-label'),
onlyLabels: core.getInput('only-labels'),
operationsPerRun: parseInt( operationsPerRun: parseInt(
core.getInput('operations-per-run', {required: true}) core.getInput('operations-per-run', {required: true})
) )