jenkinsci / jenkinsci/github-checks-plugin
Cannot set `GitSCMStatusChecksExtension` when `GitSCMChecksContext` uses `BuildData`
- Dominant language
- Java
- Stars
- 89
- Forks
- 50
- Avg merge
- 13h 55m
- Merged PRs (30d)
- 7
Description
### Description
Default checks are published to GitHub with the name `Jenkins` when no SCM is configured on the job (`CpsFlowDefinition`). A valid `GitSCMChecksContext` is created because the build contains a valid `hudson.plugins.git.util.BuildData` object.
That is awesome, however, it is not currently possible to `skip` that check or to configure the name.
### Steps to reproduce
1. Create a new pipeline job
2. Use the following pipeline script
3. Run the job
```groovy
#!/usr/bin/groovy
node {
stage ('checkout') {
checkout scm: [
$class: 'GitSCM',
branches: [[name: "*/master"]],
extensions: [
[$class: 'CleanBeforeCheckout'],
[$class: 'GitSCMStatusChecksExtension', name: 'Custom Name', skip: false]
],
userRemoteConfigs: [[credentialsId: 'your-github-app-credential', url: 'https://github.com/user/repo.git']]
]
}
}
```
#### Current behaviour
```
[...]
Fetching changes from the remote Git repository
[...]
[GitHub Checks] GitHub check (name: Jenkins, status: IN_PROGRESS) has been published.
```
#### Expected behaviour
```
[...]
Fetching changes from the remote Git repository
[...]
[GitHub Checks] GitHub check (name: Custom Name, status: IN_PROGRESS) has been published.
```
### Implementation suggestion
I am not sure I know where to start with this issue. The configuration are retrieved in [BuildStatusChecksPublisher](https://github.com/jenkinsci/checks-api-plugin/blob/master/src/main/java/io/jenkins/plugins/checks/status/BuildStatusChecksPublisher.java#L72). They could try to retrieve some config persisted in the Run object (like BuildData) to know the check property. At the moment, `GitSCMStatusChecksExtension` is not persisted in the Run.
Contributor guide
Assessment
This issue has not been assessed yet.