The organization scan recreates a hook for all repositories for which there is an item. We can see that the WebHook of each repository is recreated:
The GitHub audit log is then showing a "hook.destroy" / "hook.create" for each repository. API rate seems to be wasted and those recreation seem unnecessary. The difference of events is odd too: [PULL_REQUEST, PUSH] vs [PULL_REQUEST, PUSH, REPOSITORY]. It seems related to how GitHub Plugin and GitHub Branch Source work together.
h3 How to Reproduce
- Configure a GitHub Server under *Manage Jenkins > Configure System > GitHub* and enabled "Manage Hooks"
- Create a log recorder in *Manage Jenkins > System Logs* for org.jenkinsci.plugins.github.webhook.WebhookManager, com.cloudbees.jenkins.GitHubWebHook
- Create an GitHub Organization item that match at least one repo
- Run the Organization Scan a few times
Check the log recorder and also the Audit log at $GITHUB_ORG_URL/settings/audit-log, You shell see that hooks are replaced on Organization Scan.