When opening a pull request from a fork, several workflow steps fail because the required secrets/repository settings are not available in the fork:
-
maven.yml / SonarCloud Analysis and Codecov uploads
- The
SonarCloud Analysis step runs unconditionally (except for Dependabot) and fails with:
ERROR - Commit creating failed: {"message":"Token required - not valid tokenless upload"}
- The
Upload test results to Codecov and Upload coverage to Codecov steps also require CODECOV_TOKEN and fail with the same tokenless-upload error.
- This makes the
build check fail for every fork PR even though the Maven build and tests pass.
-
dependency-review.yml / Dependency review
- The action fails on forks with:
Dependency review is not supported on this repository. Please ensure that Dependency graph is enabled
- Forks usually do not have the dependency graph enabled, so this check cannot succeed.
Suggested fix
- Expose
SONAR_TOKEN and CODECOV_TOKEN as job-level environment variables in maven.yml and gate the Sonar/Codecov steps on them being non-empty, so they are skipped on fork PRs where the secrets are withheld.
- Add an
if: github.event.repository.fork == false guard (or similar) to the dependency-review job so it does not run on forks.
This keeps the CI green for fork contributors without changing the behaviour in the upstream repository, where the secrets and dependency graph are available.
When opening a pull request from a fork, several workflow steps fail because the required secrets/repository settings are not available in the fork:
maven.yml/ SonarCloud Analysis and Codecov uploadsSonarCloud Analysisstep runs unconditionally (except for Dependabot) and fails with:Upload test results to CodecovandUpload coverage to Codecovsteps also requireCODECOV_TOKENand fail with the same tokenless-upload error.buildcheck fail for every fork PR even though the Maven build and tests pass.dependency-review.yml/ Dependency reviewSuggested fix
SONAR_TOKENandCODECOV_TOKENas job-level environment variables inmaven.ymland gate the Sonar/Codecov steps on them being non-empty, so they are skipped on fork PRs where the secrets are withheld.if: github.event.repository.fork == falseguard (or similar) to thedependency-reviewjob so it does not run on forks.This keeps the CI green for fork contributors without changing the behaviour in the upstream repository, where the secrets and dependency graph are available.