This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-bot.git


The following commit(s) were added to refs/heads/master by this push:
     new c1f4c09  fix: don't add `awaiting review` if the PR is draft.
c1f4c09 is described below

commit c1f4c098c3fb07de095be9731e1b45c1f451da74
Author: plainheart <[email protected]>
AuthorDate: Mon Mar 29 10:57:55 2021 +0800

    fix: don't add `awaiting review` if the PR is draft.
---
 index.js | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/index.js b/index.js
index 5ba0e4a..a95a582 100644
--- a/index.js
+++ b/index.js
@@ -190,15 +190,14 @@ module.exports = (app) => {
     });
 
     app.on(['pull_request.synchronize'], async context => {
-        let addLabel;
         const removeLabel = getRemoveLabel(context, 'PR: revision needed');
-        if (!context.payload.pull_request.draft) {
-            addLabel = context.octokit.issues.addLabels(
+        const addLabel = context.payload.pull_request.draft
+            ? Promise.resolve()
+            : context.octokit.issues.addLabels(
                 context.issue({
                     labels: ['PR: awaiting review']
                 })
-            );
-        }
+              );
         return Promise.all([removeLabel, addLabel]);
     });
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to