feat: verify sonar cube token is set before running checks#1157
Open
stetsche wants to merge 4 commits into
Open
feat: verify sonar cube token is set before running checks#1157stetsche wants to merge 4 commits into
stetsche wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the SonarQube GitHub Actions workflow to avoid running the SonarQube build/scan job when the SONAR_TOKEN secret is unavailable, preventing failures in contexts where secrets aren’t provided.
Changes:
- Added a
check-sonar-tokenjob that detects whetherSONAR_TOKENis present and exposes the result as a job output. - Gated the
build(build + Sonar analysis) job behind that output so it only runs when the token is available.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1157 +/- ##
=========================================
Coverage 86.04% 86.04%
Complexity 2312 2312
=========================================
Files 291 291
Lines 6442 6442
Branches 402 402
=========================================
Hits 5543 5543
Misses 645 645
Partials 254 254 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e1d64d6 to
f0a8498
Compare
|
|
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.



Description:
This pull request updates the SonarQube GitHub Actions workflow to improve security and reliability by conditionally running the analysis only if the required secret is set, and by pinning the SonarQube scan action to a specific commit for reproducibility.
Workflow improvements:
check-sonar-tokenjob that checks if theSONAR_TOKENsecret is set, and only allows the mainbuildjob to run if the token is present. This prevents workflow failures when the secret is missing.buildjob to explicitly setcontents: read, following the principle of least privilege.Dependency management:
SonarSource/sonarqube-scan-actionused in the frontend scan step to a specific commit hash (c7ee0f9...), improving security and reproducibility by avoiding potential issues with future updates to the action.Checklist:
Make sure you tick all the boxes below if they are true or do not apply before you ask for review
Required for all pull requests:
If applicable to this PR: