beatngu13
(Daniel Kraus)
April 20, 2021, 9:09pm
1
This question is related to Github Actions. Public repo. You’re not authorized to run analysis . But instead of randoms contributors, I’m dealing with (known) bots. For example, I use Dependabot in some of my projects. When I receive a PR, the build fails with “You’re not authorized to run analysis”:
beatngu13:develop
← beatngu13:dependabot/github_actions/actions/cache-v2.1.5
opened 05:39AM - 19 Apr 21 UTC
Bumps [actions/cache](https://github.com/actions/cache) from v2.1.4 to v2.1.5.
<… details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/actions/cache/releases">actions/cache's releases</a>.</em></p>
<blockquote>
<h2>v2.1.5</h2>
<ul>
<li>Fix permissions error seen when extracting caches with GNU tar that were previously created using BSD tar (<a href="https://github-redirect.dependabot.com/actions/cache/issues/527">actions/cache#527</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/actions/cache/commit/1a9e2138d905efd099035b49d8b7a3888c653ca8"><code>1a9e213</code></a> Update cache module to v1.0.7 (<a href="https://github-redirect.dependabot.com/actions/cache/issues/562">#562</a>)</li>
<li><a href="https://github.com/actions/cache/commit/981fa981ed950efef5277587ee4ba0eead30cadf"><code>981fa98</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/actions/cache/issues/469">#469</a> from ericmj/patch-1</li>
<li><a href="https://github.com/actions/cache/commit/4498c5b4d8b0673dbc7d9731bc11d9cc5a2c6087"><code>4498c5b</code></a> Drop the example based on using pip's internals (<a href="https://github-redirect.dependabot.com/actions/cache/issues/519">#519</a>)</li>
<li><a href="https://github.com/actions/cache/commit/4134e6de47156381d31ff74f8aabf86718858f70"><code>4134e6d</code></a> It is not recommended to cache node_modules (<a href="https://github-redirect.dependabot.com/actions/cache/issues/537">#537</a>)</li>
<li><a href="https://github.com/actions/cache/commit/62a4d754427893bc6d043c6d4f5486490cab29b6"><code>62a4d75</code></a> Also cache _build for Elixir</li>
<li>See full diff in <a href="https://github.com/actions/cache/compare/v2.1.4...1a9e2138d905efd099035b49d8b7a3888c653ca8">compare view</a></li>
</ul>
</details>
<br />
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
I wonder what is the “Sonar-way” to handle PRs from bots like this. Add it to the Sonar organization? Skip the analysis? (I assume this will also be addressed via MMF-1371 ?)
Hello @beatngu13 thanks for reaching us!
Can you share your GitHub Action for both scenarios: a normal one and the one which is triggered by the Dependabot? SonarCloud authorization in such scenario is based on a token you generate in SC and configure at GitHub Action . I am guessing this token is not properly configured when the action is triggered by the bot.
MMF-1371 and random contributors are a different scenario: here users are not part of the organization, don’t have a token and can’t have one as well, but must be allowed to scan. At your scenario you can provide the token to the bot.
beatngu13
(Daniel Kraus)
April 21, 2021, 9:39pm
3
Hi @Alexandre_Holzhey ,
thx for the prompt feedback.
Both scenarios trigger this workflow .
Also note that in the case of Dependabot, the PRs stem from branches within the target repo, no forks involved (e.g. this branch ).
Initially, I thought the SONAR_TOKEN
might be an issue, so I created a dedicated repo secret for Dependabot with the same name, but it didn’t help.
Thanks for the information @beatngu13 .
Could you please echo the value of SONAR_TOKEN
in the pipeline and run it for both a normal event and the bot? Just to make sure the token is there (just tell me that, don’t paste this info here). The message you provided is mostly related to an non-existent/invalid token. The activity on our side is minimal for such scenario (i have no much to investigate here). But please take note of the exact timestamp for these runs (you should also echo this), so i can try to find the request on our side.
beatngu13
(Daniel Kraus)
April 25, 2021, 8:13pm
5
I have added a check to the workflow . Here are the (secure) results:
Run triggered by me: https://github.com/beatngu13/pdf-zoom-wizard/runs/2432869026?check_suite_focus=true#step:10:12
Run triggered by Dependabot: https://github.com/beatngu13/pdf-zoom-wizard/runs/2433059707?check_suite_focus=true#step:10:12
This is weird, because I added SONAR_TOKEN
to Settings > Secrets > Dependabot, too. (Although I don’t know why the token isn’t visible at all, since Dependabot’s PRs are not forks.)
I think I have found the issue :
Starting March 1st, 2021 workflow runs that are triggered by Dependabot […] will be treated as if they were opened from a repository fork.
The community isn’t happy about this since the only workaround seems to be to expose secrets to any fork.
In case of SonarCloud, is there a way to add a bot such as Dependabot to the organization?
beatngu13
(Daniel Kraus)
June 8, 2021, 8:29pm
8
Update: The corresponding Dependabot issue has been closed with an FAQ and a bunch of workarounds.
Personally, I currently only run the analysis step if the actor is not Dependabot:
if: ${{ github.actor != 'dependabot[bot]' }}
1 Like
system
(system)
Closed
June 15, 2021, 8:30pm
9
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.