Repository navigation
chore: #2080 Skip sonar-cloud-analysis job on pull requests from forks - #2081
Merged
lbroudoux merged 1 commit intoMay 4, 2026
Merged
Conversation
…rom forks The existing 'if: github.repository_owner == \"microcks\"' guard does not actually exclude fork PRs - github.repository_owner resolves to the owner of the base repository (always 'microcks'), not the head of the PR. As a result, every fork PR triggers the job, which then fails because GitHub Actions does not pass repository secrets to PRs from forks and SONAR_TOKEN ends up empty, producing the "Project not found" error visible on every fork PR opened against microcks#2058. Augment the guard so that, for pull_request events, the head repo must match the base repo. push and schedule events keep running unconditionally because they always have access to secrets. Behaviour matrix after the fix: - push to master: runs (unchanged). - schedule cron: runs (unchanged). - pull_request from a same-repo branch (maintainer): runs (unchanged). - pull_request from a fork: cleanly skipped instead of failing. Skipped jobs surface as a neutral status in the PR check list, so contributors and reviewers no longer have to dig through logs to confirm the failure is the SonarCloud-on-fork-PR limitation rather than the contribution itself. Resolves microcks#2080 Signed-off-by: Git-HimanshuRathi <[email protected]>
Heyy-Himanshuu
requested review from
SebastienDegodez,
lbroudoux and
yada
as code owners
May 4, 2026 08:41
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.
Summary
fixes #2080.
The existing
if: github.repository_owner == "microcks"guard on thesonar-cloud-analysisworkflow does not actually exclude fork PRsgithub.repository_ownerresolves to the owner of the base repository (alwaysmicrocks), not the head of the PR. As a result, every fork PR triggers the job and fails because GitHub Actions doesn't pass repository secrets to PRs from forks, soSONAR_TOKENends up empty and the scanner reports "Project not found."This PR augments the guard so that, for
pull_requestevents, the PR head repo must match the base repo.pushandscheduleevents keep running unconditionally because they always have access to secrets.Behaviour after the fix
pushto masterschedule(cron)pull_requestfrom same-repo branch (maintainer)pull_requestfrom forkSkipped jobs surface as a neutral status in the PR check list, so contributors and reviewers don't have to dig through logs to confirm the failure was the SonarCloud-on-fork-PR limitation rather than the contribution itself.
Test plan
sonar-cloud-analysis / Build and analyze.sonar-cloud-analysis / Build and analyzeas skipped, not failing.Related issue(s)
Resolves #2080