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 fd2b81e  fix: still handle doc-related logic in `edit` event when PR 
is closed.
fd2b81e is described below

commit fd2b81ef7fc25b172b42f24deb9c690829d8e85d
Author: plainheart <y...@all-my-life.cn>
AuthorDate: Sat Oct 8 13:35:52 2022 +0800

    fix: still handle doc-related logic in `edit` event when PR is closed.
---
 index.js | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/index.js b/index.js
index 84ed69d..a17e3f2 100644
--- a/index.js
+++ b/index.js
@@ -238,18 +238,13 @@ module.exports = (/** @type {Probot} */ app) => {
 
     app.on(['pull_request.edited'], async context => {
         const pr = context.payload.pull_request;
-        if (pr.state === 'closed') {
-            return;
-        }
+        const isOpen = pr.state === 'open';
 
         const addLabel = [];
         const removeLabel = [];
 
-        if (pr.draft) {
-            removeLabel.push(labelText.PR_AWAITING_REVIEW);
-        }
-        else {
-            addLabel.push(labelText.PR_AWAITING_REVIEW);
+        if (isOpen) {
+            (pr.draft ? removeLabel : 
addLabel).push(labelText.PR_AWAITING_REVIEW);
         }
 
         const content = pr.body || '';


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org
For additional commands, e-mail: commits-h...@echarts.apache.org

Reply via email to