fix: skip secret-dependent CI steps for fork PRs#1411
Open
IgnacioN99 wants to merge 1 commit into
Open
Conversation
SonarQube Scanner fails on fork PRs because SONAR_TOKEN and SONAR_HOST_URL secrets are not available in that context. The `Commit & push API Docs` step would similarly fail since the GITHUB_TOKEN has read-only permissions for forks. Add `if` conditions to skip both steps when the PR originates from a fork. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
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.



Problem
CI fails on PRs coming from forks. GitHub does not expose repository secrets to fork PRs for security reasons, so any step depending on secrets fails.
Validated by opening a test fork PR (#1410) —
Merge Resultsjob failed immediately atSonarQube ScannerbecauseSONAR_TOKENandSONAR_HOST_URLwere empty.Related task: https://app.notion.com/p/e4411b2f2b8b4a0e87f1f9a1d5cf315a
Root cause
Two steps in
merge_resultsjob are incompatible with fork PRs:SONAR_TOKEN+SONAR_HOST_URL(unavailable in forks)PUSH_KEY(unavailable in forks)Fix
Add an
ifcondition to both steps to skip them when the PR originates from a fork:This keeps full CI behavior for PRs from within the repo while gracefully skipping secret-dependent steps for external contributors.
Test plan
Merge Resultspasses (SonarQube skipped)