Is it possible edit the the URL of a webhook in a repo while still maintaining the secret?

I am trying to mass-update a bunch of webhook in my repos but want to maintain the same secret.

From the API (https://developer.github.com/v3/repos/hooks/#edit-a-hook) it implies that it will just override the whole webhook config as it assumes if no secret is passed, it will override. Am I correct in my understanding or is there some other way to accomplish this?

Hi @mechastorm,

Thanks for being here! You can try mass updating of webhooks via the API. A two step process:

List the available hooks for each repository and note the returned id.
Edit the hook by referencing the repository id and passing in your required parameters.

You can do this using the following commands:

# Query the hook
curl -L -H 'Authorization: token OAUTH-TOKEN' \
http(s)://[hostname]/api/v3/repos/:owner/:repo/hooks

# Update the hook
curl -L -H 'Authorization: token OAUTHTOKEN' \
https://[hostname]/api/v3/repos/:owner/:repo/hooks/:id \
--request PATCH \
-d '{"active": true,"add_events": ["push_request"],"config": {"url": "http://example.com/jenkins","content_type": "json"}}'

While curl is good for individual requests, using something like the Octokit library to script the update could be a better approach as you can iterate over each repository a lot easier.