mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-02 10:59:43 +00:00
feat(webhook): fire repository event on repo rename (#38641)
Repository create and delete already fire `repository` webhooks, rename did not. This adds the `renamed` action with `changes.name.from` carrying the previous name, and renders it in the chat converters. Actions workflows are unaffected, they still do not trigger on rename. AI assistance was used for the implementation and tests. Fixes https://github.com/go-gitea/gitea/issues/34891. Co-authored-by: roman s <roman.sukach@dust-labs.com> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -424,6 +424,8 @@ type ChangesPayload struct {
|
||||
Body *ChangesFromPayload `json:"body,omitempty"`
|
||||
// Changes made to the reference
|
||||
Ref *ChangesFromPayload `json:"ref,omitempty"`
|
||||
// Changes made to the repository name
|
||||
Name *ChangesFromPayload `json:"name,omitempty"`
|
||||
// Changes made to the labels added
|
||||
AddedLabels []*Label `json:"added_labels"`
|
||||
// Changes made to the labels removed
|
||||
@@ -508,6 +510,8 @@ const (
|
||||
HookRepoCreated HookRepoAction = "created"
|
||||
// HookRepoDeleted deleted
|
||||
HookRepoDeleted HookRepoAction = "deleted"
|
||||
// HookRepoRenamed renamed
|
||||
HookRepoRenamed HookRepoAction = "renamed"
|
||||
)
|
||||
|
||||
// RepositoryPayload payload for repository webhooks
|
||||
@@ -520,6 +524,8 @@ type RepositoryPayload struct {
|
||||
Organization *User `json:"organization"`
|
||||
// The user who performed the action
|
||||
Sender *User `json:"sender"`
|
||||
// Changes made to the repository
|
||||
Changes *ChangesPayload `json:"changes,omitempty"`
|
||||
}
|
||||
|
||||
// JSONPayload JSON representation of the payload
|
||||
|
||||
Reference in New Issue
Block a user