mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-04 08:17:24 -05:00
Send push event when tag is created or deleted (#13999)
Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
e7a77d32cc
commit
66379ba7ae
@ -96,7 +96,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
|||||||
return fmt.Errorf("Old and new revisions are both %s", git.EmptySHA)
|
return fmt.Errorf("Old and new revisions are both %s", git.EmptySHA)
|
||||||
}
|
}
|
||||||
var commits = &repo_module.PushCommits{}
|
var commits = &repo_module.PushCommits{}
|
||||||
if opts.IsTag() { // If is tag reference {
|
if opts.IsTag() { // If is tag reference
|
||||||
if pusher == nil || pusher.ID != opts.PusherID {
|
if pusher == nil || pusher.ID != opts.PusherID {
|
||||||
var err error
|
var err error
|
||||||
if pusher, err = models.GetUserByID(opts.PusherID); err != nil {
|
if pusher, err = models.GetUserByID(opts.PusherID); err != nil {
|
||||||
@ -105,9 +105,25 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
|||||||
}
|
}
|
||||||
tagName := opts.TagName()
|
tagName := opts.TagName()
|
||||||
if opts.IsDelRef() {
|
if opts.IsDelRef() {
|
||||||
|
notification.NotifyPushCommits(
|
||||||
|
pusher, repo,
|
||||||
|
&repo_module.PushUpdateOptions{
|
||||||
|
RefFullName: git.TagPrefix + tagName,
|
||||||
|
OldCommitID: opts.OldCommitID,
|
||||||
|
NewCommitID: git.EmptySHA,
|
||||||
|
}, repo_module.NewPushCommits())
|
||||||
|
|
||||||
delTags = append(delTags, tagName)
|
delTags = append(delTags, tagName)
|
||||||
notification.NotifyDeleteRef(pusher, repo, "tag", opts.RefFullName)
|
notification.NotifyDeleteRef(pusher, repo, "tag", opts.RefFullName)
|
||||||
} else { // is new tag
|
} else { // is new tag
|
||||||
|
notification.NotifyPushCommits(
|
||||||
|
pusher, repo,
|
||||||
|
&repo_module.PushUpdateOptions{
|
||||||
|
RefFullName: git.TagPrefix + tagName,
|
||||||
|
OldCommitID: git.EmptySHA,
|
||||||
|
NewCommitID: opts.NewCommitID,
|
||||||
|
}, repo_module.NewPushCommits())
|
||||||
|
|
||||||
addTags = append(addTags, tagName)
|
addTags = append(addTags, tagName)
|
||||||
notification.NotifyCreateRef(pusher, repo, "tag", opts.RefFullName)
|
notification.NotifyCreateRef(pusher, repo, "tag", opts.RefFullName)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user