I've got a weird issue on my Jenkins server. We have a GitHub Organization job in Jenkins which corresponds to a GitHub organization with a variety of public/private repos. When I rescan the organization, I see a slew of errors like this in the Jenkins log, for both the public/private repos:
Failed to add GitHub webhook for GitHubRepositoryName[host=github.com,username=<my github org>,repository=<some repo>] java.lang.NullPointerException: There is no credentials with admin access to manage hooks on GitHubRepositoryName[host=github.com,username=<my github org>,repository=ci-control] at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:231) at org.jenkinsci.plugins.github.webhook.WebhookManager$2.applyNullSafe(WebhookManager.java:179) at org.jenkinsci.plugins.github.webhook.WebhookManager$2.applyNullSafe(WebhookManager.java:175) at org.jenkinsci.plugins.github.util.misc.NullSafeFunction.apply(NullSafeFunction.java:18)
I have double-checked the access token settings, and the token has all scopes for "repo" (as the documentation says). I have also tried granting permission to the "admin:repo_hook" and "admin:org_hook" scopes, but it didn't make any difference.
The credential for the API token is a username/password, and although the username was blank I tried entering the actual username for the token owner. This also didn't make a difference, and weirdly, in the exception stacktrace in the logfile, it says username=<my github org> rather than username=<my github user> as I would have expected.
Finally, I should note – the actual organization scan succeeds. We can build projects, and when we create new branches or pull requests, they get built as expected. It's only the organization scan that throws up a bunch of warnings.
Am I doing something wrong, or is this a legit bug in the plugin?