# Github status checks on Jenkins DSL pipeline

**URL:** <https://community.jenkins.io/t/github-status-checks-on-jenkins-dsl-pipeline/26033>\
**Category:** Using Jenkins\
**Created:** [January 22, 2025, 2:24pm UTC](https://community.jenkins.io/t/github-status-checks-on-jenkins-dsl-pipeline/26033 "2025-01-22T14:24:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahuls36](https://avatars.discourse-cdn.com/v4/letter/r/e47774/32.png) [@rahuls36](https://community.jenkins.io/u/rahuls36)\
**Post date:** [January 22, 2025, 2:24pm UTC](https://community.jenkins.io/t/github-status-checks-on-jenkins-dsl-pipeline/26033/1 "2025-01-22T14:24:51Z")

</div>

I am trying to migrate my Jenkins freestlye job to pipeline. In the post build action i am using

```auto
publish coverage to GitHub
where 
Jacoco coverage counter type as Instruction  
Publish result as comment.

```

Now i am trying to do same from Jenkins pipeline.

```auto
post {
        success {
            jacoco(
                execPattern: ' **/**.exec',
                classPattern: '**/classes',
                sourcePattern: '**/src/main/java',
                exclusionPattern: '',
                inclusionPattern: ' **/*.java,** /*.groovy, **/*.kt,** /*.kts'
            )
            script {
                 step([$class: 'MasterCoverageAction', 
                 jacocoCounterType: 'INSTRUCTION',
                 publishResultAs: 'COMMENT'
                 ])
            }
        }
    }

```

But seeing errot as this.

```auto
WARNING: Unknown parameter(s) found for class type 'com.github.terma.jenkins.githubprcoveragestatus.MasterCoverageAction': publishResultAs
[Pipeline] }
[Pipeline] // script
Error when executing success post condition:
java.lang.UnsupportedOperationException: Can't find GIT_URL or CHANGE_URL in envs

```

I can see GIT\_URL was set as gloabal variable in freestyle job but in pipeline even though i am passing from Jenkins it is not recognising GIT\_URL.

```auto
environment {
        SKIP_SONAR = false // Default to false
        GIT_URL = "https://github.com/test/test.git"
    }
    stages {
        stage('Debug') {
            steps {
                script {
                    'sh printenv'
                    def gitUrl = env.GIT_URL
                    echo "Automatically set GIT_URL: ${gitUrl}"
                }
            }
        }

```

---

<div class="post-metadata">

**Author:** ![rahuls36](https://avatars.discourse-cdn.com/v4/letter/r/e47774/32.png) [@rahuls36](https://community.jenkins.io/u/rahuls36)\
**Post date:** [January 22, 2025, 4:26pm UTC](https://community.jenkins.io/t/github-status-checks-on-jenkins-dsl-pipeline/26033/2 "2025-01-22T16:26:16Z")

</div>

I am able to fix issue by myself. With this it is able to publish the code to github.

```auto
    post {
        success {
            jacoco(
                execPattern: ' **/**.exec',
                classPattern: '**/classes',
                sourcePattern: '**/src/main/java',
                exclusionPattern: '',
                inclusionPattern: ' **/*.java,** /*.groovy, **/*.kt,** /*.kts'
            )
            script {
                 step([$class: 'CompareCoverageAction', 
                 jacocoCounterType: 'INSTRUCTION',
                 publishResultAs: 'COMMENT',
                 scmVars: [GIT_URL: env.GIT_URL]
                 ])
            }
        }
    }

```

How ever still i am seeing warning.  
WARNING: Unknown parameter(s) found for class type ‘com.github.terma.jenkins.githubprcoveragestatus.CompareCoverageAction’: jacocoCounterType

---

<div class="post-metadata">

**Author:** ![uhafner](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/uhafner/32/68_2.png) [@uhafner](https://community.jenkins.io/u/uhafner)\
**Post date:** [January 23, 2025, 7:41am UTC](https://community.jenkins.io/t/github-status-checks-on-jenkins-dsl-pipeline/26033/3 "2025-01-23T07:41:31Z")

</div>

Good too see that it works now.

Please note that you are using the deprecated JaCoCo plugin: publishing code coverage results is now provided by the [Coverage Plugin](https://github.com/jenkinsci/coverage-plugin). It has built-in support to publish the results to GitHub.
