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

zixuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-test-infra.git


The following commit(s) were added to refs/heads/master by this push:
     new 88136c6  avoid duplicate docbot comment (#56)
88136c6 is described below

commit 88136c64f0bb839f0a3cf746e90a1a673b1b6fe8
Author: tison <[email protected]>
AuthorDate: Tue Aug 16 17:30:24 2022 +0800

    avoid duplicate docbot comment (#56)
    
    * avoid duplicate docbot comment
    
    Signed-off-by: tison <[email protected]>
    
    * simplify boolean logic
    
    Signed-off-by: tison <[email protected]>
---
 docbot/main.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/docbot/main.go b/docbot/main.go
index aceb279..f98bfff 100644
--- a/docbot/main.go
+++ b/docbot/main.go
@@ -311,6 +311,11 @@ func (a *Action) onPullRequestOpenedOrEdited() error {
 
        // Add missing label
        if a.config.GetEnableLabelMissing() && checkedCount == 0 {
+               if _, exist := currentLabelsSet[a.config.GetLabelMissing()]; 
exist {
+                       logger.Infoln("Already added missing label.")
+                       return fmt.Errorf("%s", MessageLabelMissing)
+               }
+
                logger.Infoln("@Add missing label")
                _, _, err = a.client.Issues.AddLabelsToIssue(a.globalContext,
                        a.config.GetOwner(), a.config.GetRepo(), 
a.config.GetNumber(),
@@ -420,6 +425,11 @@ func (a *Action) onPullRequestLabeledOrUnlabeled() error {
 
        // Add missing label
        if a.config.GetEnableLabelMissing() && checkedCount == 0 {
+               if _, exist := currentLabelsSet[a.config.GetLabelMissing()]; 
exist {
+                       logger.Infoln("Already added missing label.")
+                       return fmt.Errorf("%s", MessageLabelMissing)
+               }
+
                logger.Infoln("@Add missing label")
                _, _, err = a.client.Issues.AddLabelsToIssue(a.globalContext,
                        a.config.GetOwner(), a.config.GetRepo(), 
a.config.GetNumber(),

Reply via email to