BUILD-11091: Adds check-sca action for enforcing that SCA is active#247
Conversation
f45a312 to
1e60405
Compare
SummaryNew The action:
Includes comprehensive ShellSpec tests, a workflow trigger for What reviewers should knowWhere to start: Key implementation details:
Testing: ShellSpec mocks are thorough but simple (shell commands only). No external API calls during tests. Success and timeout paths are covered, plus edge cases like empty measures arrays and HTTP 404s. Potential review focus:
|
There was a problem hiding this comment.
Pull request overview
Adds a new check-sca composite GitHub Action + workflow to enforce that SonarQube SCA has run for a repository by polling SonarQube/SonarCloud metrics across the three internal instances.
Changes:
- Added
check-scacomposite action + bash implementation that discovers candidate project keys and polls Sonar measures forsca_count_any_issue. - Added ShellSpec coverage for the new script behavior (project key discovery, API polling, main success/timeout).
- Wired the new action into the repo’s Sonar config and introduced a reusable workflow intended to be used as a required check.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
check-sca/check-sca.sh |
Implements key discovery + polling logic for SCA verification. |
check-sca/action.yml |
Composite action wrapper fetching credentials from Vault and invoking the script. |
.github/workflows/check-sca.yml |
Workflow to run the required SCA check on PRs/pushes. |
spec/check-sca_spec.sh |
ShellSpec tests for the new check-sca script. |
sonar-project.properties |
Adds check-sca to Sonar sources for analysis. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1e60405 to
1bc8e9d
Compare
ed1f3aa to
87f53a1
Compare
87f53a1 to
25f20d1
Compare
|
There was a problem hiding this comment.
Good first action overall — the polling logic, Vault error handling, and step summary are well-structured. Two issues need addressing before merge: the workflow's lack of a checkout step silently voids most of the key discovery logic, and the jq mock in the spec replaces the real filter rather than testing it.



Context
We (EngXP) are trying to add enforcement of SonarQube SCA Scanning for GitHub repos in the SonarSource GitHub organization. We first thought of using a quality gate for this, but confirmed with the SCA Product Manager that this is not possible for checking whether a SonarQube project has been scanned by SCA or not (see slack convo).
We decided to go with this alternative solution of having a GitHub Action that is configured as a required check as part of a Ruleset at the SonarSource GitHub org level. This PR implements that check and tests it with GitHub repos that we expect to pass or fail.
What Changed?
check-scaaction, which when applied to a GitHub repo, checks if the GitHub repo that makes the commit has ever had its dependencies scanned by SCA in any of the three internal SQ instances (SQC-EU, SQC-US, and SQS-Next). If dependencies have never been scanned for the GitHub Repo's correlating SQ Project in any of the three instances, then the check fails and prevents the PR from being mergedTest Plan
portkey-admin-automation, which we expect to pass the checkpeachee-cfamily-sources, which we expect to fail the checkmasterbranch instead of this feature branch.github/workflowsto be called by the branch ruleset, so this is necessary and the SCA check should succeed on the commit of this PR tomaster