Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning exit code 0 on Github permissions error #605

Open
martinpilch opened this issue Mar 11, 2024 · 1 comment
Open

Returning exit code 0 on Github permissions error #605

martinpilch opened this issue Mar 11, 2024 · 1 comment

Comments

@martinpilch
Copy link

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?

@martinpilch martinpilch changed the title Returning exit 0 on Github permissions error Returning exit code 0 on Github permissions error Mar 15, 2024
@f-meloni
Copy link
Member

Hi!
In this case we return the code that danger-js retrurns us, so I think this would be a thing that should be changed on Danger-JS

exit(exitCode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants