Fix release published actions not triggering for releases created from existing tags

This commit is contained in:
Laura Hausmann 2024-04-14 23:45:18 +02:00
parent 20c0292b5c
commit 46977b0f01
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
4 changed files with 15 additions and 15 deletions

View file

@ -199,7 +199,7 @@ func CreateNewTag(ctx context.Context, doer *user_model.User, repo *repo_model.R
// delAttachmentUUIDs accept a slice of attachments' uuids which will be deleted from the release
// editAttachments accept a map of attachment uuid to new attachment name which will be updated with attachments.
func UpdateRelease(ctx context.Context, doer *user_model.User, gitRepo *git.Repository, rel *repo_model.Release,
addAttachmentUUIDs, delAttachmentUUIDs []string, editAttachments map[string]string,
addAttachmentUUIDs, delAttachmentUUIDs []string, editAttachments map[string]string, createdFromTag bool,
) error {
if rel.ID == 0 {
return errors.New("UpdateRelease only accepts an exist release")
@ -292,11 +292,11 @@ func UpdateRelease(ctx context.Context, doer *user_model.User, gitRepo *git.Repo
}
if !rel.IsDraft {
if !isCreated {
notify_service.UpdateRelease(gitRepo.Ctx, doer, rel)
if createdFromTag || isCreated {
notify_service.NewRelease(gitRepo.Ctx, rel)
return nil
}
notify_service.NewRelease(gitRepo.Ctx, rel)
notify_service.UpdateRelease(gitRepo.Ctx, doer, rel)
}
return nil
}