Webhook doesn't fire on creation or deletion of a repository that does not belong to an organisation #5501

Closed
opened 2025-11-02 06:26:49 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @JustAnotherArchivist on GitHub (Jun 5, 2020).

Steps to reproduce

  1. Set up a default webhook; in my case, I used a Gitea webhook with JSON POST, but I would be surprised if the details mattered.
  2. Create a new repository under a user, i.e. outside of an organisation.

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:

2c5b3c72e8/modules/notification/webhook/webhook.go (L102)
2c5b3c72e8/modules/notification/webhook/webhook.go (L117)

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

  • Gitea version (or commit ref): 1.11.6
  • Git version: not relevant
  • Operating system: unknown, but I can ask if it matters
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
    • Can't test currently
  • Log gist: not relevant
Originally created by @JustAnotherArchivist on GitHub (Jun 5, 2020). ## Steps to reproduce 1. Set up a default webhook; in my case, I used a Gitea webhook with JSON POST, but I would be surprised if the details mattered. 2. Create a new repository under a user, i.e. outside of an organisation. ## 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: https://github.com/go-gitea/gitea/blob/2c5b3c72e8ebdf94ac764267fa78e4a0c5e93dc6/modules/notification/webhook/webhook.go#L102 https://github.com/go-gitea/gitea/blob/2c5b3c72e8ebdf94ac764267fa78e4a0c5e93dc6/modules/notification/webhook/webhook.go#L117 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 - Gitea version (or commit ref): 1.11.6 - Git version: not relevant - Operating system: unknown, but I can ask if it matters - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [ ] Not relevant - [x] Can't test currently - Log gist: not relevant
Author
Owner

@JustAnotherArchivist commented on GitHub (Jun 5, 2020):

#9180 is a partial duplicate of this but only mentions deletion, not creation.

@JustAnotherArchivist commented on GitHub (Jun 5, 2020): #9180 is a partial duplicate of this but only mentions deletion, not creation.
Author
Owner

@stale[bot] commented on GitHub (Aug 9, 2020):

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.

@stale[bot] commented on GitHub (Aug 9, 2020): 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.
Author
Owner

@JustAnotherArchivist commented on GitHub (Aug 9, 2020):

Yes, this is still valid.

@JustAnotherArchivist commented on GitHub (Aug 9, 2020): Yes, this is still valid.
Author
Owner

@jamesorlakin commented on GitHub (Oct 1, 2020):

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.

@jamesorlakin commented on GitHub (Oct 1, 2020): 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5501