diff options
author | sillyguodong <33891828+sillyguodong@users.noreply.github.com> | 2023-04-08 04:40:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-07 16:40:40 -0400 |
commit | 3876f56c7b62ad07856719b9897d20a427711e0f (patch) | |
tree | 574bf04bb6434d71b2dab2f2391dfdff2665791a /services | |
parent | 518d384346abeef833122b871411788b6d7f3ebe (diff) | |
download | gitea-3876f56c7b62ad07856719b9897d20a427711e0f.tar.gz gitea-3876f56c7b62ad07856719b9897d20a427711e0f.zip |
Set `ref` to fully-formed of the tag when trigger event is `release` (#23944)
Fix #23943
When trigger event is `release`, ref should be like
`refs/tags/<tag_name>` instead of `CommitID`
Diffstat (limited to 'services')
-rw-r--r-- | services/actions/notifier.go | 6 | ||||
-rw-r--r-- | services/actions/notifier_helper.go | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/services/actions/notifier.go b/services/actions/notifier.go index 90eed83eff..6956c25cee 100644 --- a/services/actions/notifier.go +++ b/services/actions/notifier.go @@ -443,17 +443,17 @@ func (n *actionsNotifier) NotifySyncDeleteRef(ctx context.Context, pusher *user_ func (n *actionsNotifier) NotifyNewRelease(ctx context.Context, rel *repo_model.Release) { ctx = withMethod(ctx, "NotifyNewRelease") - notifyRelease(ctx, rel.Publisher, rel, rel.Sha1, api.HookReleasePublished) + notifyRelease(ctx, rel.Publisher, rel, api.HookReleasePublished) } func (n *actionsNotifier) NotifyUpdateRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release) { ctx = withMethod(ctx, "NotifyUpdateRelease") - notifyRelease(ctx, doer, rel, rel.Sha1, api.HookReleaseUpdated) + notifyRelease(ctx, doer, rel, api.HookReleaseUpdated) } func (n *actionsNotifier) NotifyDeleteRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release) { ctx = withMethod(ctx, "NotifyDeleteRelease") - notifyRelease(ctx, doer, rel, rel.Sha1, api.HookReleaseDeleted) + notifyRelease(ctx, doer, rel, api.HookReleaseDeleted) } func (n *actionsNotifier) NotifyPackageCreate(ctx context.Context, doer *user_model.User, pd *packages_model.PackageDescriptor) { diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go index 49a8c4e744..376c9820f1 100644 --- a/services/actions/notifier_helper.go +++ b/services/actions/notifier_helper.go @@ -216,7 +216,7 @@ func newNotifyInputFromIssue(issue *issues_model.Issue, event webhook_module.Hoo return newNotifyInput(issue.Repo, issue.Poster, event) } -func notifyRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release, ref string, action api.HookReleaseAction) { +func notifyRelease(ctx context.Context, doer *user_model.User, rel *repo_model.Release, action api.HookReleaseAction) { if err := rel.LoadAttributes(ctx); err != nil { log.Error("LoadAttributes: %v", err) return @@ -225,7 +225,7 @@ func notifyRelease(ctx context.Context, doer *user_model.User, rel *repo_model.R mode, _ := access_model.AccessLevel(ctx, doer, rel.Repo) newNotifyInput(rel.Repo, doer, webhook_module.HookEventRelease). - WithRef(ref). + WithRef(git.TagPrefix + rel.TagName). WithPayload(&api.ReleasePayload{ Action: action, Release: convert.ToRelease(ctx, rel), |