Skip to content

ci: skip SonarCloud scan on Dependabot PRs (unblocks #918) - #926

Merged
fernandotonon merged 2 commits into
masterfrom
ci/sonar-skip-without-token
Jul 23, 2026
Merged

ci: skip SonarCloud scan on Dependabot PRs (unblocks #918)#926
fernandotonon merged 2 commits into
masterfrom
ci/sonar-skip-without-token

Conversation

@fernandotonon

@fernandotonon fernandotonon commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Problem

Dependabot PRs (e.g. #918, bumping SonarSource/sonarqube-scan-action v4→v6) are permanently BLOCKED because the unit-tests-linux job's Run sonar-scanner step fails with:

401 Not authorized. Please check the 'SONAR_TOKEN' environment variable...
Action failed: sonar-scanner failed with exit code 3

This is not a code problem — the tests all pass (FAILED_SUITES: 0). GitHub deliberately withholds repository secrets from Dependabot-triggered workflow runs, so SONAR_TOKEN is empty and the scan 401s. This blocks every Dependabot PR the same way.

(The v4→v6 bump itself is safe for us: our args: values contain no spaces, so the v6 arg-quoting breaking change doesn't apply.)

Fix

Gate the sonar-scanner step on github.actor != 'dependabot[bot]'. The SonarCloud quality gate still runs on branch pushes and same-repo PRs — where it actually matters — and simply skips in the secret-less Dependabot context instead of hard-failing.

Effect

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated automated validation workflows to skip SonarCloud analysis for Dependabot pull requests when required credentials are unavailable.
    • Prevented unnecessary scan failures during automated dependency updates.

Dependabot PRs run without repository secrets, so SONAR_TOKEN is empty and the
sonar-scanner step in the unit-tests-linux job fails with a 401 "Not authorized"
— blocking every Dependabot PR (e.g. #918, the sonarqube-scan-action v4→v6 bump)
even though the code and tests are fine (FAILED_SUITES: 0).

Gate the scan step on `github.actor != 'dependabot[bot]'`. The quality gate
still runs on branch pushes and same-repo PRs, which is where it matters; the
scan legitimately cannot run in the secret-less Dependabot context.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@fernandotonon, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2c3115f7-c286-4736-9bdd-bb125fde01bd

📥 Commits

Reviewing files that changed from the base of the PR and between b780a29 and 0db662b.

📒 Files selected for processing (1)
  • .github/workflows/deploy.yml
📝 Walkthrough

Walkthrough

The deployment workflow updates the SonarCloud analysis step to skip execution when the GitHub actor is dependabot[bot].

Changes

SonarCloud workflow guard

Layer / File(s) Summary
Dependabot analysis condition
.github/workflows/deploy.yml
The SonarCloud analysis step runs only when the GitHub actor is not dependabot[bot].

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main CI change and its Dependabot scope.
Description check ✅ Passed The description covers the problem, the CI fix, and the expected effect, which satisfies the template’s core content despite different headings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/sonar-skip-without-token

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b780a29e9c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/deploy.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/deploy.yml (1)

1528-1556: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Restore the SonarCloud action invocation.

This step only has with: inputs and no uses: or run: key, so GitHub Actions has nothing executable for the named Sonar scanner step. Keep the Dependabot skip and add the pinned SonarSource/sonarqube-scan-action reference back.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/deploy.yml around lines 1528 - 1556, Restore the
executable action invocation for the “Run sonar-scanner” step by adding the
pinned SonarSource/sonarqube-scan-action reference before its existing with:
arguments. Preserve the current Dependabot condition, environment variables, and
scanner arguments unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/deploy.yml:
- Around line 1528-1556: Restore the executable action invocation for the “Run
sonar-scanner” step by adding the pinned SonarSource/sonarqube-scan-action
reference before its existing with: arguments. Preserve the current Dependabot
condition, environment variables, and scanner arguments unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b73c2c81-9d17-4b95-a954-e87044c775bf

📥 Commits

Reviewing files that changed from the base of the PR and between 83d5025 and b780a29.

📒 Files selected for processing (1)
  • .github/workflows/deploy.yml

Review fix (Codex P1 + CodeRabbit Critical): the previous commit's edit dropped
the 'uses: SonarSource/sonarqube-scan-action@v4' line while adding the
Dependabot if-guard, leaving the step with no action to run — which would have
made the whole workflow step invalid, not just skipped for Dependabot. Restore
the uses line; the if-guard stays.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@fernandotonon
fernandotonon merged commit 4b12fa1 into master Jul 23, 2026
21 checks passed
@fernandotonon
fernandotonon deleted the ci/sonar-skip-without-token branch July 23, 2026 13:53
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