From b0a65a6a5a66c8a5464924eba44c4fd98ccd133b Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Tue, 19 Dec 2023 10:29:49 -0500 Subject: [PATCH] fix(exec): set tag prefix if user does not provide one (#512) --- command/pipeline/exec.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/command/pipeline/exec.go b/command/pipeline/exec.go index d9f44fa9..fbec4f58 100644 --- a/command/pipeline/exec.go +++ b/command/pipeline/exec.go @@ -268,6 +268,16 @@ func exec(c *cli.Context) error { } } + // account for users omitting the `refs/tags` prefix of the tag value + tag := c.String("tag") + + if len(tag) > 0 { + if !strings.HasPrefix(tag, "refs/tags/") { + logrus.Debugf("setting tag value to refs/tags/%s", tag) + tag = "refs/tags/" + tag + } + } + // create the pipeline configuration // // https://pkg.go.dev/github.com/go-vela/cli/action/pipeline?tab=doc#Config @@ -276,7 +286,7 @@ func exec(c *cli.Context) error { Branch: c.String("branch"), Comment: c.String("comment"), Event: c.String("event"), - Tag: c.String("tag"), + Tag: tag, Target: c.String("target"), Org: c.String(internal.FlagOrg), Repo: c.String(internal.FlagRepo),