jenkinsci / pipeline-github-plugin

Pipeline: GitHub
https://plugins.jenkins.io/pipeline-github/
MIT License
159 stars 73 forks source link

Please print Github JSON on errors #108

Closed ricochet1k closed 1 year ago

ricochet1k commented 2 years ago

What feature do you want to see added?

I've been trying to get pullRequest merging working properly, but All I get is very short and unhelpful error messages like this:

java.io.IOException: Method Not Allowed (405)
    at org.eclipse.egit.github.core.client.GitHubClient.createException(GitHubClient.java:597)
    at org.eclipse.egit.github.core.client.GitHubClient.sendJson(GitHubClient.java:676)
    at org.eclipse.egit.github.core.client.GitHubClient.put(GitHubClient.java:811)
    at org.jenkinsci.plugins.pipeline.github.client.ExtendedPullRequestService.merge(ExtendedPullRequestService.java:109)
    at org.jenkinsci.plugins.pipeline.github.PullRequestGroovyObject.merge(PullRequestGroovyObject.java:798)
    at org.jenkinsci.plugins.pipeline.github.PullRequestGroovyObject.merge(PullRequestGroovyObject.java:781)

What I would like to see is something like this either added to the Exception or logged to the job's Console Output:

{
  "message": "You're not authorized to push to this branch. Visit https://docs.github.com/articles/about-protected-branches/ for more information.",
  "documentation_url": "https://docs.github.com/articles/about-protected-branches"
}

That is the error message I got from manually going through the Github App JWT/Installation Token madness to try to reproduce the behavior, but it told me what I needed to do to fix it.

Upstream changes

No response

aaronwalker commented 1 year ago

Github App permissions issue