Skip to content

Returning exit code 0 on Github permissions error #605

@martinpilch

Description

@martinpilch

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions