Skip to content

ci: skip SonarQube scan on Dependabot PR runs - #3403

Merged
deacon-mp merged 1 commit into
masterfrom
ci/skip-sonar-on-dependabot-prs
Jul 23, 2026
Merged

ci: skip SonarQube scan on Dependabot PR runs#3403
deacon-mp merged 1 commit into
masterfrom
ci/skip-sonar-on-dependabot-prs

Conversation

@deacon-mp

Copy link
Copy Markdown
Contributor

Summary

Gates the SonarQube Scan step in Code Quality so it is skipped on Dependabot-authored PR runs, where it can only fail.

Problem

Every Dependabot PR now fails all four build (3.x, ...style,coverage-ci) legs at the SonarQube step with Not authorized / exit 3 — see #3402, where the test phase itself passed 562/562 on all four Python versions. The action's log shows SONAR_TOKEN: empty.

Root cause: GitHub supplies Dependabot-triggered workflow runs with secrets from the separate Dependabot secrets store, not the Actions store. That secret did not survive the repository transfer — Dependabot PR #3399 passed these same legs on 2026-07-08 with an unchanged workflow, and #3402 fails them today. The Actions-scope SONAR_TOKEN still works, so pushes and human PRs are unaffected.

Fix

Add github.actor != 'dependabot[bot]' to the step's existing condition. Chosen over alternatives:

Coverage is not lost: the merged result is still analyzed by the push-event run on master.

Follow-up (out of scope)

Restoring analysis parity for Dependabot PRs requires adding SONAR_TOKEN to this repo's Dependabot secrets (admin / Infra). If that is done, this guard clause can be reverted. sonar-project.properties also still binds to the pre-transfer mitre SonarCloud organization, which maintainers may want to revisit.

Dependabot-authored pull_request runs receive no repository secrets, so
SONAR_TOKEN is empty and the scan step can only fail (exit 3, 'Not
authorized'), turning every Dependabot PR red regardless of test results.
This began when the repository transfer dropped the Dependabot-scope
secret; the Actions-scope secret still works, so pushes and human PRs
are unaffected. Skip the scan for Dependabot runs; the merged result is
still analyzed by the push-event run on master, and fork PRs already
route through the trusted sonar-fork-pr.yml path.
@deacon-mp
deacon-mp merged commit f129110 into master Jul 23, 2026
9 checks passed
@deacon-mp
deacon-mp deleted the ci/skip-sonar-on-dependabot-prs branch July 23, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant