diff --git a/action.yml b/action.yml index 92d3d30..d859383 100644 --- a/action.yml +++ b/action.yml @@ -10,6 +10,10 @@ inputs: repoUrl: description: "repository url where action runs" required: true + skipDraft: + description: "skip notification for draft pull requests" + required: false + default: "false" runs: using: node12 main: index.js diff --git a/index.js b/index.js index 3b07fff..dd06546 100644 --- a/index.js +++ b/index.js @@ -205,7 +205,15 @@ const refineToApiUrl = repoUrl => { core.info("Fetching pulls..."); + const skipDraft = core.getInput("skipDraft") === "true"; + for (const pullInfo of await fetchPulls()) { + // Skip draft PRs if skipDraft option is enabled + if (skipDraft && pullInfo.draft) { + core.info(`Skipping draft PR #${pullInfo.number}: ${pullInfo.title}`); + continue; + } + const pull = Pull.create(pullInfo); core.info(`Fetching reviewers of #${pull.number}...`);