danger icon indicating copy to clipboard operation
danger copied to clipboard

Running danger without write access to the repo

Open KrauseFx opened this issue 10 years ago • 6 comments

Currently when running danger on an open source project with a key set up to not have write access I run into

Found 2 error(s) and I don't have write access to the PR set a PR status. bundle exec danger returned exit code 1

As far as I remember we had a way to not set the return status for this situation. What's the best way to solve this? I'll submit a PR to both the setup and the docs to make this easier, just wanted to check what's your thoughts @orta :+1:

KrauseFx avatar Mar 04 '16 02:03 KrauseFx

Danger should always fail if you get errors and we can't set a status, that's the point of Danger, if you don't think it's worth failing for, then use warn. Otherwise Danger only provides some text in a message somewhere.

orta avatar Mar 04 '16 12:03 orta

The wording relates to https://github.com/danger/danger/issues/105 and https://github.com/danger/danger/issues/106

As far as I remember we had a way to not set the return status for this situation

This can be solved by adding a --no-fail flag to bundle exec danger - so instead of returning a fail if you have errors, it can pass.

orta avatar Mar 10 '16 14:03 orta

I keep getting this error either my account is owner / admin and all the flags for the token are switched on.

Do you guys have any idea what could be the cause? PS: I am using travis-ci.

valeriomazzeo avatar Jun 09 '16 16:06 valeriomazzeo

I'm running into this too. I'm using bundle exec danger --fail-on-errors=false and I still get:

Danger has failed this build. 
Found 2 errors and I don't have write access to the PR to set a PR status.

Which I don't understand because the token has all repo permissions: screen shot 2017-12-06 at 3 29 38 pm

And it's actually able to send comments.

NachoSoto avatar Dec 06 '17 23:12 NachoSoto

Hi @NachoSoto 👋

This problem happens because a user that owns Github Token (DANGER_GITHUB_API_TOKEN) has no write access to the repo itself.

You token setup is absolutely correct ✅ , but I guess you're using a CI Github user, so just invite this user to a repo:

Screenshot 2022-06-14 at 09 24 40

I figured this out reading Danger's source code, there's a nice comment when this error message is thrown: https://github.com/danger/danger/blob/560733f739db3b740dba4f80b29a61a38eb9eeaf/lib/danger/request_sources/github/github.rb#L228

makaroni4 avatar Jun 14 '22 07:06 makaroni4

New phone who dis

NachoSoto avatar Jun 19 '22 14:06 NachoSoto