Skip to content

Commit

Permalink
fix(exec): set tag prefix if user does not provide one (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper authored Dec 19, 2023
1 parent 3c55490 commit b0a65a6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion command/pipeline/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
Expand Down

0 comments on commit b0a65a6

Please sign in to comment.