Skip to content

Commit 66379ba

Browse files
CirnoTzeripathlunny
authored
Send push event when tag is created or deleted (#13999)
Co-authored-by: zeripath <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
1 parent e7a77d3 commit 66379ba

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

services/repository/push.go

+17-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
9696
return fmt.Errorf("Old and new revisions are both %s", git.EmptySHA)
9797
}
9898
var commits = &repo_module.PushCommits{}
99-
if opts.IsTag() { // If is tag reference {
99+
if opts.IsTag() { // If is tag reference
100100
if pusher == nil || pusher.ID != opts.PusherID {
101101
var err error
102102
if pusher, err = models.GetUserByID(opts.PusherID); err != nil {
@@ -105,9 +105,25 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
105105
}
106106
tagName := opts.TagName()
107107
if opts.IsDelRef() {
108+
notification.NotifyPushCommits(
109+
pusher, repo,
110+
&repo_module.PushUpdateOptions{
111+
RefFullName: git.TagPrefix + tagName,
112+
OldCommitID: opts.OldCommitID,
113+
NewCommitID: git.EmptySHA,
114+
}, repo_module.NewPushCommits())
115+
108116
delTags = append(delTags, tagName)
109117
notification.NotifyDeleteRef(pusher, repo, "tag", opts.RefFullName)
110118
} else { // is new tag
119+
notification.NotifyPushCommits(
120+
pusher, repo,
121+
&repo_module.PushUpdateOptions{
122+
RefFullName: git.TagPrefix + tagName,
123+
OldCommitID: git.EmptySHA,
124+
NewCommitID: opts.NewCommitID,
125+
}, repo_module.NewPushCommits())
126+
111127
addTags = append(addTags, tagName)
112128
notification.NotifyCreateRef(pusher, repo, "tag", opts.RefFullName)
113129
}

0 commit comments

Comments
 (0)