- versions used: latest sonarcloud GitHub action
- error observed:
- Bump @types/node from 14.17.11 to 16.7.1 by dependabot[bot] · Pull Request #7 · jerome-benoit/charging-stations-simulator · GitHub.
- The same happen under another repo under another project on sonarcloud and github: [1/3] Track tasks usage statistics by jerome-benoit · Pull Request #365 · poolifier/poolifier · GitHub
Hi @jerome-benoit , welcome to the community.
I apologize for the very late reply.
I notice something strange in the analysis. In PR #365 of project poolifier/poolifier, the SonarCloud analysis is triggered and successful when the Node version is 14.x.
But on the Checkout
phase the commit that is retrieved is the latest from master
, not the one from the Pull Request.
The run logs
Checking out the ref
/usr/bin/git checkout --progress --force -B master refs/remotes/origin/master
Reset branch 'master'
Branch 'master' set up to track remote branch 'master' from 'origin'.
/usr/bin/git log -1 --format='%H'
'61a90f2e524662cc63d46f0a0ffbe599b1ac44b5'
The code analyzed by SonarCloud is master
, not the PR, and the check is sent to commit 61a90f2e524662cc63d46f0a0ffbe599b1ac44b5
, not on the latest commit of the PR. That’s why the check stays in the “Expected” status.
I suspect some configuration problem on the Github workflow, could you check the branch configuration and triggers on your workflow, comparing with some working repository, to ensure the analyzed code is from the PR branch and not the main branch every time?
Was busy lately, sorry. Where do I find the that configuration?
The workflow on GitHub is here for the first repository: charging-stations-simulator/ci.yml at master · jerome-benoit/charging-stations-simulator · GitHub
The run is limited to PR on master branch but I do see anything stating that it should only run from the master branch.
It was a GitHub action configuration issue. I’ve fixed it and the sonarcloud report are back on PRs.
Thanks.
Thanks for the feedback, I’m glad you found the solution!
Would you mind explaining the fix you did, and marking your post as the solution? It could help someone with the same issue in the future.
The commit that fixed it: Refine CI run conditions · jerome-benoit/charging-stations-simulator@c4f1190 · GitHub
In the workflow definition, pull_request_target
was replaced by pull_request
.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.