Skip to content

feat(webhook): fire repository event on repo rename - #38641

Open
majorissuerep wants to merge 11 commits into
go-gitea:mainfrom
majorissuerep:feat/webhook-repo-rename
Open

feat(webhook): fire repository event on repo rename#38641
majorissuerep wants to merge 11 commits into
go-gitea:mainfrom
majorissuerep:feat/webhook-repo-rename

Conversation

@majorissuerep

Copy link
Copy Markdown
Contributor

Summary

Fixes #34891.

Repository create and delete already fire repository webhooks. Rename only updated the activity feed via RenameRepository, so integrations that track repos by name never saw renames.

Changes

  • Add HookRepoRenamed (action: "renamed") on RepositoryPayload
  • Include changes.name.from with the previous repository name
  • Implement webhookNotifier.RenameRepository (notify path already called from ChangeRepositoryName)
  • Handle rename in chat converters (slack/discord/dingtalk/feishu/telegram/matrix/msteams/wechatwork)
  • Update en-US webhook event description
  • Integration test: create-only repository webhook + API rename

No UI surface change beyond existing webhook settings copy (locale string). Screenshots not required per CONTRIBUTING (non-UI backend/event fix).

Test plan

  • go test ./services/webhook/ ./modules/structs/
  • make test-integration#Test_WebhookRepositoryRename
  • make test-integration#Test_WebhookRepository$ (create regression)
  • Manual path covered by integration test:
    1. Repo webhook subscribed to Repository
    2. PATCH /api/v1/repos/{owner}/{repo} with new name
    3. Delivery with X-Gitea-Event: repository, action=renamed, changes.name.from=<old>

AI assistance used for implementation and tests; changes reviewed and exercised locally.

Repository create/delete already emitted repository webhooks, but rename
only updated the activity feed. External caches tracking repos by name
never learned about renames (go-gitea#34891).

- Add HookRepoRenamed action and optional changes.name.from on payload
- Implement webhookNotifier.RenameRepository
- Cover chat converters and add integration test via API rename

Fixes go-gitea#34891

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
@github-actions github-actions Bot added topic/webhooks type/feature Completely new functionality. Can only be merged if feature freeze is not active. labels Jul 26, 2026
roman s added 5 commits July 26, 2026 15:54
testifylint equal-values: HookRepoAction is a string type so
assert.Equal is preferred over assert.EqualValues.

Assisted-by: hermes:grok-4.5
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 26, 2026
@lunny lunny added this to the 28.0.0 milestone Jul 26, 2026
roman s added 4 commits July 27, 2026 12:09
Sync with upstream main so the approved PR is no longer behind the
base branch (sole remaining merge blocker).

Assisted-by: hermes:grok-4.5
Re-sync: base advanced during prior CI; BEHIND remains the sole
merge-API blocker on this approved green PR.

Assisted-by: hermes:grok-4.5
Merge-enablement sync: approved PR green but 1 commit behind base;
squash merge only blocked by outdated head.

Assisted-by: hermes:grok-4.5
@majorissuerep

Copy link
Copy Markdown
Contributor Author

Noted on #34891 — rename payload shape (action=renamed, changes.name.from). Nothing else pending on my side here.

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 1 This PR needs approval from one additional maintainer to be merged. topic/webhooks type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Webhook does not fire on repo rename

3 participants