rmetzger / flink-community-tools

MIT License
13 stars 8 forks source link

Adding labels doesn't work if user doesn't have "edit repo" permissions #12

Open rmetzger opened 3 years ago

rmetzger commented 3 years ago
2021-09-24 06:54:02,600 INFO d.r.PullRequestLabelCache [check-pr-thread] Getting labels for PR #17345 from GitHub
2021-09-24 06:54:03,721 WARN d.r.App [check-pr-thread] Error while checking for new PRs
org.kohsuke.github.HttpException: {"message":"Must have admin rights to Repository.","documentation_url":"https://docs.github.com/rest/reference/issues#update-an-issue"}
        at org.kohsuke.github.Requester.handleApiError(Requester.java:703) ~[github-api-1.96-SNAPSHOT.jar:?]
        at org.kohsuke.github.Requester._to(Requester.java:306) ~[github-api-1.96-SNAPSHOT.jar:?]
        at org.kohsuke.github.Requester.to(Requester.java:247) ~[github-api-1.96-SNAPSHOT.jar:?]
        at org.kohsuke.github.GHIssue.editIssue(GHIssue.java:188) ~[github-api-1.96-SNAPSHOT.jar:?]
        at org.kohsuke.github.GHIssue.setLabels(GHIssue.java:222) ~[github-api-1.96-SNAPSHOT.jar:?]
        at org.kohsuke.github.GHIssue._addLabels(GHIssue.java:254) ~[github-api-1.96-SNAPSHOT.jar:?]
        at org.kohsuke.github.GHIssue.addLabels(GHIssue.java:232) ~[github-api-1.96-SNAPSHOT.jar:?]
        at de.robertmetzger.PullUpdater.checkPullRequests(PullUpdater.java:152) ~[classes/:?]
        at de.robertmetzger.App.lambda$main$0(App.java:39) ~[classes/:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_302]
Caused by: org.kohsuke.github.HttpException: Server returned HTTP response code: 403, message: 'Forbidden' for URL: https://api.github.com/repos/apache/flink/issues/17345
        at org.kohsuke.github.Requester.parse(Requester.java:646) ~[github-api-1.96-SNAPSHOT.jar:?]
        at org.kohsuke.github.Requester.parse(Requester.java:607) ~[github-api-1.96-SNAPSHOT.jar:?]
        at org.kohsuke.github.Requester._to(Requester.java:285) ~[github-api-1.96-SNAPSHOT.jar:?]
        ... 8 more
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://api.github.com/repos/apache/flink/issues/17345
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_302]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_302]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_302]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_302]
        at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1950) ~[?:1.8.0_302]
        at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1945) ~[?:1.8.0_302]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_302]
        at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1944) ~[?:1.8.0_302]
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1514) ~[?:1.8.0_302]
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498) ~[?:1.8.0_302]

This is fixed in https://github.com/hub4j/github-api/issues/1049