fix(ci): skip SonarQube scan for dependabot-triggered PRs - #202
Closed
syed-awsaf-informed wants to merge 1 commit into
Closed
fix(ci): skip SonarQube scan for dependabot-triggered PRs#202syed-awsaf-informed wants to merge 1 commit into
syed-awsaf-informed wants to merge 1 commit into
Conversation
Contributor
✅ OSS Checks PassedAll tracked OSS checks passed in this run.
Results from commit 8230d8c, view the full job summary |
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts the Maven CI workflow so code coverage (JaCoCo generation) still runs on all PRs, while the SonarQube scan is skipped on Dependabot-authored PRs where secrets are not available.
Changes:
- Split the previous combined
mvn verify + sonarinvocation into a standalonemvn verifycoverage step plus a separate SonarQube scan step. - Added an
if: github.actor != 'dependabot[bot]'guard so SonarQube scan is skipped (not failed) on Dependabot PRs. - Added an explicit check that the JaCoCo XML report exists before attempting the SonarQube scan.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+63
to
+66
| - name: SonarQube Scan | ||
| if: github.actor != 'dependabot[bot]' | ||
| env: | ||
| GH_PACKAGES_PAT: ${{ secrets.GH_PACKAGES_PAT }} |
Comment on lines
57
to
62
| - name: Code Coverage | ||
| env: | ||
| GH_PACKAGES_PAT: ${{ secrets.GH_PACKAGES_PAT }} | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_N3 }} | ||
| run: ./mvnw $MAVEN_CLI_OPTS verify -Dsonar.projectKey=National-Node-Net_federator -Dsonar.organization=national-node-net -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml org.sonarsource.scanner.maven:sonar-maven-plugin:sonar | ||
| run: ./mvnw $MAVEN_CLI_OPTS verify | ||
| - name: Verify JaCoCo XML exists | ||
| run: ls -l target/site/jacoco/jacoco.xml |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



GitHub does not pass repository/org secrets to workflow runs triggered by a Dependabot-authored pull_request event. Since the SonarQube scan step used
SONAR_TOKEN_N3, it always failed with "Not authorized or project not found" on Dependabot PRs. This splits the Code Coverage step (which still always runsmvn verifyto produce the JaCoCo report) from the SonarQube scan step, and guards the scan step withif: github.actor != 'dependabot[bot]'so it is skipped (not failed) for Dependabot PRs, matching the pattern already used in National-Digital-Twin/ospo-resources' ci.yml.