Skip to content

fix(webhook): deliver create events for tag pushes - #38639

Open
majorissuerep wants to merge 6 commits into
go-gitea:mainfrom
majorissuerep:fix/webhook-create-tag-push
Open

fix(webhook): deliver create events for tag pushes#38639
majorissuerep wants to merge 6 commits into
go-gitea:mainfrom
majorissuerep:fix/webhook-create-tag-push

Conversation

@majorissuerep

Copy link
Copy Markdown
Contributor

Summary

Fixes #38438.

Create-only webhooks stopped receiving tag create deliveries when a branch-oriented branch_filter (e.g. master / main) was set. That came from #35567 applying the branch filter to tag create/delete payloads, not only to tag push payloads.

Also, tag CreateRef was nested under a successful GetCommit, so a missing/unreadable peeled commit dropped the create event entirely even though the tag ref was created.

Changes

Test plan

  • go test ./services/webhook/ ./services/repository/
  • make test-integration#Test_WebhookCreateTagViaGitPush
  • make test-integration#Test_WebhookCreateTagViaAPI
  • make test-integration#Test_WebhookCreate (branch create regression)
  • Manual scenario matching the report:
    1. Webhook: custom events → Create only
    2. Branch filter: master (branch-oriented)
    3. git tag webhook-create-tag-38438 && git push origin refs/tags/webhook-create-tag-38438
    4. Delivery arrives with X-Gitea-Event: create, ref_type=tag

Proof (local)

  • Unit: PASS (services/webhook, services/repository)
  • Integration create-only tag push with filter master: PASS
  • Integration API tag create: PASS
  • Integration branch create: PASS

AI assistance used for implementation and tests; changes reviewed and exercised locally via the commands above.

Tag create/delete webhooks were incorrectly subject to branch_filter after
the tag-push filter fix, so a create-only hook with a branch-oriented
filter (e.g. master) never fired for git tag pushes (go-gitea#38438).

- Apply branch_filter only to push events and branch create/delete
- Keep filtering tag *push* events (preserves go-gitea#35449 / go-gitea#35567)
- Emit CreateRef for new tags even when GetCommit fails
- Add unit and integration coverage for create-only tag push

Fixes go-gitea#38438

Assisted-by: hermes:grok-4.5
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 26, 2026
@majorissuerep

Copy link
Copy Markdown
Contributor Author

#38438 updated — tag create deliveries restored under branch-oriented filters; CreateRef no longer gated on GetCommit.

Assisted-by: Hermes:glm-5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. topic/webhooks type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create webhook event is not triggered when creating tags via git push

2 participants