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

tibordigana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jenkins-env.git


The following commit(s) were added to refs/heads/master by this push:
     new dd9f217  [INFRA-18734] Jenkins builds fail on email notifications due 
to unknown user ID "github"
dd9f217 is described below

commit dd9f2179fa5a8748a26a15755578b3a6dbfbc652
Author: tibordigana <[email protected]>
AuthorDate: Sat Aug 3 00:12:21 2019 +0200

    [INFRA-18734] Jenkins builds fail on email notifications due to unknown 
user ID "github"
---
 vars/jenkinsNotify.groovy | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/vars/jenkinsNotify.groovy b/vars/jenkinsNotify.groovy
index a47daa4..9f80f73 100644
--- a/vars/jenkinsNotify.groovy
+++ b/vars/jenkinsNotify.groovy
@@ -88,20 +88,25 @@ def call(Map params = [:]) {
     }
 
     // add the changes to the email
-    if (currentBuild.changeSets.isEmpty() ) {
-        messageBody = messageBody+"\n\nNo changes.\n";
+       def changes = currentBuild?.changeSets
+       def authors = []
+    if (changes.isEmpty() ) {
+        messageBody = messageBody + "\n\nNo changes.\n";
     } else {
         messageBody = messageBody + "\n\nChanges:\n";
-        for (def changeSet in currentBuild.changeSets) {
+        for (def changeSet in changes) {
             for (def change in changeSet) {
                 messageBody = messageBody + "\n* 
${change.msg.trim().replaceAll('\n','\n  ')}"
+                authors.add(change.author)
             }
         }
         messageBody = messageBody + "\n"
     }
-    messageBody = messageBody + '\n${FAILED_TESTS}\n' + messageTail
-    // send the mail
+    println("The authors of changes ${authors.unique()}.")
+    sendMail &= !authors.contains('github')
     if (sendMail) {
+        messageBody = messageBody + '\n${FAILED_TESTS}\n' + messageTail
+        println("Sending email with message body \"${messageBody}\"")
         emailext body: messageBody, recipientProviders: providers, replyTo: 
'[email protected]', subject: messageSubject, to: 
'[email protected]'
     }
 }

Reply via email to