<commit_before>#!/usr/bin/env groovy
/* Generic notification function that aims to be reusable between most
pipelines.

reference:
- https://www.cloudbees.com/blog/sending-notifications-pipeline
- https://wiki.jenkins.io/display/JENKINS/Email-ext+plugin
*/
import static hudson.model.Result.FAILURE
import static hudson.model.Result.SUCCESS

def call(Map params = [:]) {

    // build status of null means successful
    def subject = "${currentBuild.result ?: 'SUCCESSFUL'}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
    def summary = "${subject} (${env.BUILD_URL})"
    def details = '''${SCRIPT, template="groovy-html.template"}'''
    def attachLog = false
    // Allways send a mail to the requestor (the one who started the job)
    def to = []
    to << emailextrecipients([[$class: 'RequesterRecipientProvider']])

    // Inform others when the build is *not* successfull
    if (currentBuild.result && currentBuild.result.isWorseThan(SUCCESS)) {
      attachLog = true
      to << emailextrecipients([
        [$class: 'CulpritsRecipientProvider'],
        [$class: 'DevelopersRecipientProvider'],
        [$class: 'FailingTestSuspectsRecipientProvider'],
        [$class: 'UpstreamComitterRecipientProvider']
        ])
    }

    // https://github.com/jenkinsci/ownership-plugin/blob/master/doc/PipelineIntegration.md
    if (ownership?.job?.ownershipEnabled) {
      to << ownership.job.primaryOwnerEmail
      to += ownership.job.secondaryOwnerEmails
    }
    try {
      if (ownership?.node?.ownershipEnabled) {
        to << ownership.node.primaryOwnerEmail
        to += ownership.node.secondaryOwnerEmails
      }
    }
    catch (e) {
       log "[notifyBuild] ${e}", level: 'WARN'<commit_msg>notifyBuild: fixed currentBuild.result check condition<commit_after>#!/usr/bin/env groovy
/* Generic notification function that aims to be reusable between most
pipelines.

reference:
- https://www.cloudbees.com/blog/sending-notifications-pipeline
- https://wiki.jenkins.io/display/JENKINS/Email-ext+plugin
*/

def call(Map params = [:]) {

    // build status of null means successful
    def subject = "${currentBuild.result ?: 'SUCCESSFUL'}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
    def summary = "${subject} (${env.BUILD_URL})"
    def details = '''${SCRIPT, template="groovy-html.template"}'''
    def attachLog = false
    // Allways send a mail to the requestor (the one who started the job)
    def to = []
    to << emailextrecipients([[$class: 'RequesterRecipientProvider']])

    // Inform others when the build is *not* successfull
    if (currentBuild.result && currentBuild.result != 'SUCCESS') {
      attachLog = true
      to << emailextrecipients([
        [$class: 'CulpritsRecipientProvider'],
        [$class: 'DevelopersRecipientProvider'],
        [$class: 'FailingTestSuspectsRecipientProvider'],
        [$class: 'UpstreamComitterRecipientProvider']
        ])
    }

    // https://github.com/jenkinsci/ownership-plugin/blob/master/doc/PipelineIntegration.md
    if (ownership?.job?.ownershipEnabled) {
      to << ownership.job.primaryOwnerEmail
      to += ownership.job.secondaryOwnerEmails
    }
    try {
      if (ownership?.node?.ownershipEnabled) {
        to << ownership.node.primaryOwnerEmail
        to += ownership.node.secondaryOwnerEmails
      }
    }
    catch (e) {
       log "[notifyBuild] ${e}", level: 'WARN'
{'fraction_non_alphanumeric': 0.1370227878070435, 'fraction_numerical': 0.0, 'mean_word_length': 3.383916990920882, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1324468', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1008, 'n_words': 220}