fix: don't add `awaiting review` if the PR is draft.
diff --git a/index.js b/index.js
index dbf2913..5ba0e4a 100644
--- a/index.js
+++ b/index.js
@@ -190,13 +190,16 @@
});
app.on(['pull_request.synchronize'], async context => {
- const addLabel = context.octokit.issues.addLabels(
- context.issue({
- labels: ['PR: awaiting review']
- })
- );
+ let addLabel;
const removeLabel = getRemoveLabel(context, 'PR: revision needed');
- return Promise.all([addLabel, removeLabel]);
+ if (!context.payload.pull_request.draft) {
+ addLabel = context.octokit.issues.addLabels(
+ context.issue({
+ labels: ['PR: awaiting review']
+ })
+ );
+ }
+ return Promise.all([removeLabel, addLabel]);
});
app.on(['pull_request.closed'], async context => {