jenkinsci / jenkinsci/checks-api-plugin

Possibility Of Specifying Credentials

Open
#187 3 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Java
Stars
49
Forks
32
Avg merge
2d 5h
Merged PRs (30d)
5

Description

### Describe your use-case which is not covered by existing documentation.

Hi there,

I was wondering if there is the possibility of specifying the credentials for junit when it publishes to GitHub Checks?

Since the project is maybe not "org" based but knowing that - using my setup GitHub App Credential:
```
withCredentials([usernamePassword(credentialsId: 'jenkins-irishgordo',
usernameVariable: 'GITHUB_APP',
passwordVariable: 'GITHUB_ACCESS_TOKEN')]) {
}
```
In the `withCredentials` block on the pipeline -> stages -> stage -> steps.
I know that I'm capable of making a raw `curl -X POST ` to https://api.github.com/repos/-usr-/repo/check-runs

Is there anyway to inject credentials into:
```
withChecks('API Tests'){
junit checksName: 'api-tests', testResults: 'tests/api_latest.xml'
}
```

I guess the use-case is right now - that a Jenkinsfile - builds a JobDSL based "pipelineJob" - that then that injects a basic declaritive pipeline script .groovy.
The triggers are setup on the JobDSL based Groovy file, with githubPullRequest -> since this is all outside of an Organization folder - I'm just wondering if selecting the credential to use could be a stand-in segway.

Thanks for any info / help / insight!
I really appreciate it all!
I also really appreciate that there is the ability to pulbish your junit results out to GitHub Checks, I think it's fantastic not having to head over to Jenkins to see the failures of the tests but instead have the tests runs propegeate to the Checks tab in GitHub.

### Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.