Deleting a branch after merging a PR does not trigger webhook #2972

Closed
opened 2025-11-02 04:55:43 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @LBlaboon on GitHub (Feb 25, 2019).

  • Gitea version (or commit ref): 1.7.2
  • Git version: 2.20.1
  • Operating system: Arch Linux
  • Database:
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

After merging a branch from a PR, if you delete the branch from the web interface then any webhooks configured to trigger on the "Delete" event will not be triggered. The webhook is only triggered when deleting a branch remotely (via git push origin :branch).

I reported the same issue with Gogs a few months ago and it was fixed with this commit: 1ec365de25

I'm guessing the same thing will need to be applied here.

Originally created by @LBlaboon on GitHub (Feb 25, 2019). - Gitea version (or commit ref): 1.7.2 - Git version: 2.20.1 - Operating system: Arch Linux - Database: - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant ## Description After merging a branch from a PR, if you delete the branch from the web interface then any webhooks configured to trigger on the "Delete" event will not be triggered. The webhook is only triggered when deleting a branch remotely (via `git push origin :branch`). I reported the same issue with Gogs a few months ago and it was fixed with this commit: https://github.com/gogs/gogs/commit/1ec365de25821ac4450996edaa2c2f7792c800b6 I'm guessing the same thing will need to be applied here.
GiteaMirror added the issue/confirmedtype/bug labels 2025-11-02 04:55:43 -06:00
Author
Owner

@stale[bot] commented on GitHub (Apr 27, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Apr 27, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@RobH123 commented on GitHub (Nov 3, 2019):

To confirm: Using v1.9.5 Gitea webhooks with All Events selected, deleting a repo branch by clicking on the trash-can icon from inside the Branch(es) GUI handler correctly gives a delete notification for the branch (followed by a somewhat unexpected push notification with commits=[ ] and after=all zeroes).

However, if you merge a PR (gives 3 notifications: pull_request [opened], pull_request [closed], and push) and then delete the branch from inside that PR GUI handler, NO FURTHER NOTIFICATIONS are given, or more specifically, there is no webhook notification that the branch has been deleted.

BTW, the documentation at https://docs.gitea.io/en-us/webhooks/ is very minimal -- a list of what notifications are given by what events would be very helpful. (I'm still trying to figure out what particular event sends the create notification. Tried looking through the code but quickly got lost -- I can see ActionCreateRepo, ActionCreateIssue, ActionCreatePull Request, and crudActionCreateFile in the code, but can't easily match those to which webhooks are actually called and from where, e.g., I think from what I've seen flying by in my webhook handler, create issue gives a issue webhook, not a create one?)

@RobH123 commented on GitHub (Nov 3, 2019): To confirm: Using v1.9.5 Gitea webhooks with `All Events` selected, deleting a repo branch by clicking on the trash-can icon from inside the Branch(es) GUI handler correctly gives a `delete` notification for the branch (followed by a somewhat unexpected `push` notification with commits=[ ] and after=all zeroes). However, if you merge a PR (gives 3 notifications: `pull_request` [opened], `pull_request` [closed], and `push`) and then delete the branch from inside that PR GUI handler, NO FURTHER NOTIFICATIONS are given, or more specifically, there is no webhook notification that the branch has been deleted. BTW, the documentation at https://docs.gitea.io/en-us/webhooks/ is very minimal -- a list of what notifications are given by what events would be very helpful. (I'm still trying to figure out what particular event sends the `create` notification. Tried looking through the code but quickly got lost -- I can see ActionCreateRepo, ActionCreateIssue, ActionCreatePull Request, and crudActionCreateFile in the code, but can't easily match those to which webhooks are actually called and from where, e.g., I think from what I've seen flying by in my webhook handler, create issue gives a `issue` webhook, not a `create` one?)
Author
Owner

@bhalbright commented on GitHub (Dec 16, 2019):

Just leaving a note that I'm going to try to fix this bug.

@bhalbright commented on GitHub (Dec 16, 2019): Just leaving a note that I'm going to try to fix this bug.
Author
Owner

@bhalbright commented on GitHub (Dec 28, 2019):

This issue can be closed, it was fixed by PR #9424 and was also backported to 1.10.0

@bhalbright commented on GitHub (Dec 28, 2019): This issue can be closed, it was fixed by PR #9424 and was also backported to 1.10.0
Author
Owner

@techknowlogick commented on GitHub (Dec 28, 2019):

@bhalbright thanks :)

@techknowlogick commented on GitHub (Dec 28, 2019): @bhalbright thanks :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2972