Skip to content

fix(ci): fix sonar-pr-analysis for fork PRs#806

Merged
mivek merged 2 commits into
mainfrom
fix/ci-sonar-pr-analysis
May 30, 2026
Merged

fix(ci): fix sonar-pr-analysis for fork PRs#806
mivek merged 2 commits into
mainfrom
fix/ci-sonar-pr-analysis

Conversation

@mivek
Copy link
Copy Markdown
Owner

@mivek mivek commented May 30, 2026

Root cause

The sonar-pr-analysis workflow failed with:

AnalysisException: Your project contains .java files, please provide compiled classes with sonar.java.binaries property

The original step order in sonar-pr-analysis.yml was:

  1. Download PR metadata
  2. Download build artifacts ← before checkout!
  3. Read PR metadata
  4. Checkout PR headclean: true wiped the class files!

actions/checkout with default clean: true deletes all untracked files, which destroyed the downloaded .class files before Sonar could analyse them.

Fixes

sonar-pr-analysis.yml (committed in previous push)

  • Added actions: read permission (required for cross-run artifact download)
  • Moved Download build artifacts to after Checkout PR head, so the checkout no longer wipes the compiled classes

maven-verify.yml

  • Guard generate-docs with if: github.event_name == 'push': its failure on a PR would set the workflow conclusion to failure, silently suppressing the Sonar workflow_run trigger
  • Remove dead artifact path **/target/jacoco.xml (JaCoCo writes to target/site/jacoco/jacoco.xml, already covered by the existing glob)

@github-actions
Copy link
Copy Markdown

Please check on sonarcloud https://sonarcloud.io/project/pull_requests_list?id=io.github.mivek%3AmetarParser that the PR does not add any issue.

@mivek mivek force-pushed the fix/ci-sonar-pr-analysis branch from 988c8a8 to 8d9c5ec Compare May 30, 2026 18:16
… path

- generate-docs job now only runs on push to main, not on PRs.
  Its failure would set workflow conclusion to 'failure' and prevent
  the sonar-pr-analysis workflow_run trigger from firing.
- Remove dead artifact upload path '**/target/jacoco.xml'; JaCoCo
  report goal writes to target/site/jacoco/jacoco.xml which is already
  covered by the '**/target/site/jacoco/**' glob.
@mivek mivek changed the title fix(ci): add actions:read permission for cross-workflow artifact down… fix(ci): fix sonar-pr-analysis for fork PRs May 30, 2026
@mivek mivek merged commit 0d6924b into main May 30, 2026
9 checks passed
@mivek mivek deleted the fix/ci-sonar-pr-analysis branch May 30, 2026 18:51
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 2.26.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant