BCR reviewer: skip draft PRs (#1929)
Addressing
https://github.com/bazelbuild/bazel-central-registry/pull/1658#issuecomment-2010947718
Tested at
https://github.com/meteorcloudy/bazel-central-registry/actions/runs/8390212422/job/22978131199
diff --git a/actions/bcr-pr-reviewer/index.js b/actions/bcr-pr-reviewer/index.js
index d468c2a..4339356 100644
--- a/actions/bcr-pr-reviewer/index.js
+++ b/actions/bcr-pr-reviewer/index.js
@@ -222,10 +222,21 @@
}
async function reviewPR(octokit, owner, repo, prNumber) {
-
console.log('\n');
console.log(`Processing PR #${prNumber}`);
+ // Skip if the PR is a draft
+ const prInfo = await octokit.rest.pulls.get({
+ owner,
+ repo,
+ pull_number: prNumber,
+ });
+
+ if (prInfo.data.draft) {
+ console.log('Skipping draft PR');
+ return;
+ }
+
// Fetch modified modules
const modifiedModules = await fetchAllModifiedModules(octokit, owner, repo, prNumber);
console.log(`Modified modules: ${Array.from(modifiedModules).join(', ')}`);