I think the issue comes from how you setup your action, the SONAR_TOKEN should come from secrets.SONAR_TOKEN and not from env.SONAR_TOKEN. Also the SONAR_TOKEN secret should correctly be defined in your repositories secrets: https://github.com/react-hook-form/error-message/settings/secrets/actions
Also thanks for your PR, but we can’t accept it, the issue is with your configuration, not the action.
Looking again at your PR I think your problem is that you are trying to use both the Automatic Analysis and the Github Action, I don’t see any error related to SONAR_TOKEN, here is what I see:
You should try again with this PR, disable the Automatic Analysis in your project settings on SonarCloud and make sure your SONAR_TOKEN secret is well defined in your Github Repository settings.
@Gregoire_Aubert yes, it has been set. Our secrets SONAR_TOKEN has been set correctly otherwise the sonar cloud analyse wouldn’t be succesful. You need to modify entrypoint.sh to reflect the correct token or remove it altogether.
The proposed changes in your PR will not work @rcmlee99. Passing secrets to a GitHub action is always done by using the with or env clauses when invoking an action (see GitHub documentation here). Otherwise any GitHub action could read whichever encrypted secret it wants to, which is obviously not secure.
The configuration described here works for all of our users, there is no change needed on our side. Please read our comments carefully.
You currently have Automatic Analysis enabled for your repository. This means that on every commit on your main branch or PR we will run an analysis for you. This means you do not have to launch an analysis with GitHub actions. We do not support having Automatic Analysis enabled and simultaneously running an analysis in your CI. Please read the Automatic Analysis documentation page carefully and see if this fits your use case. If so, you do not have make any more changes on your side.
This indicates that the SONAR_TOKEN secret is very probably not correctly set-up on your side, otherwise it would have shown *** instead.
Could you please decide if you want to use Automatic Analysis or not, and we’ll take further from there.
So are you saying that if a workflow is triggered by a pull request from a fork (which is how must opensource projects work) that we cannot use ANY secret?? That seems very limiting
I came across this post as we have the same issue with our GitHub repo - we operate an external fork model for contributions and as a result the token is not being picked up.
Example here. This worked fine on a forked repo but as soon as the PR is made, it’s failing the tests despite the token being present in the repo.
In the post mentioned above, it seems that there are new options for public repos to use pull_request_target rather than pull_request - should we explore this route?