diff --git a/api/deployment/create.go b/api/deployment/create.go index 1ad549c07..2075e65da 100644 --- a/api/deployment/create.go +++ b/api/deployment/create.go @@ -93,6 +93,11 @@ func CreateDeployment(c *gin.Context) { input.SetTask("deploy:vela") } + // if ref is not provided, use repo default branch + if len(input.GetRef()) == 0 { + input.SetRef(fmt.Sprintf("refs/heads/%s", r.GetBranch())) + } + // send API call to create the deployment err = scm.FromContext(c).CreateDeployment(u, r, input) if err != nil {