danger / swift

⚠️ Stop saying "you forgot to …" in code review
https://danger.systems/swift/
MIT License
1.04k stars 135 forks source link

Returning exit code 0 on Github permissions error #605

Open martinpilch opened 3 months ago

martinpilch commented 3 months ago

We were trying to configure Danger for our Github repo on CircleCI and we noticed it exits with code 0 even if token has wrong permissions. E.g. it prints:

Request failed [403]: https://example.com/repos/example/repo/pulls/1
Response: {
  "message": "Resource not accessible by personal access token",
  "documentation_url": "https://docs.github.com/rest/pulls/pulls#get-a-pull-request"
}
warning: The --path option is deprecated. Pass the path(s) to lint last to the swiftlint command.

Found only warnings, not failing the build.
Request failed [403]: https://example.com/repos/example/repo/pulls/1
Response: {
  "message": "Resource not accessible by personal access token",
  "documentation_url": "https://docs.github.com/rest/pulls/pulls#get-a-pull-request"
}
Feedback: https://example.com/repos/example/repo/pulls/1#issuecomment-123456
Could not add a commit status, the GitHub token for Danger does not have access rights.
If the build fails, then danger will use a failing exit code.

Is there a way how to force it to exit with 1 and to make whole pipeline failing?