-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webhook doesn't fire on creation or deletion of a repository that does not belong to an organisation #11766
Comments
#9180 is a partial duplicate of this but only mentions deletion, not creation. |
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions. |
Yes, this is still valid. |
Default webhooks themselves don't do anything, they just are webhooks that get automatically added to fresh repos as far as I'm aware. System webhooks logically should, seeing as they're wider than just a repo in scope. I'll have a poke around to solve it for them. However, this begs the question, should individual repos also fire a create (only if a default is defined) and delete event for their webhooks? I can't really come up with an argument for no in such a case, but I might be overlooking something. |
This small PR changes the webhook trigger behaviour to be more in line with what's expected. (When 'repository' events are enabled, of course) In other words: For system-wide or default webhooks, repository events will now trigger said webhook. Previously it had to be under an organization for create events to be visible - a tad unexpected! Deleting a repository will now fire its own defined webhooks, not just organisational and system ones. In order to enable the latter the webhook has to now be triggered before the actual repo undergoes deletion. I'm willing to tweak this to try and 'grab' the webhook model beforehand and trigger the webhook notifier directly afterwards, but this may make the code more complex for little benefit. Closes #11766, #9180.
Steps to reproduce
Expected behaviour
A
repository
webhook event is sent to signal the creation of the new repository.Actual behaviour
No webhook call.
Repository creation and deletion events are only executed when the repo belongs to an organisation:
gitea/modules/notification/webhook/webhook.go
Line 102 in 2c5b3c7
gitea/modules/notification/webhook/webhook.go
Line 117 in 2c5b3c7
While that probably made sense in the past, it doesn't mix well with default webhooks nor with the new system-wide webhooks (#10546). Those should fire on all repositories.
(I have not tested system-wide webhooks, but given the code mentioned above, it should behave the same.)
System information
[x]
):The text was updated successfully, but these errors were encountered: