Skip to content

Commit

Permalink
enhance(api/deploy): use default branch if ref is not supplied (#961)
Browse files Browse the repository at this point in the history
* enhance(api/deploy): use default branch if ref is not supplied

* ditch contractions
  • Loading branch information
ecrupper committed Sep 11, 2023
1 parent bb79525 commit 9b84d35
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/deployment/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9b84d35

Please sign in to comment.