Skip to content

Commit

Permalink
produce actionable error (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcncl authored Dec 30, 2024
1 parent 369794d commit de985b8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/cmd/build/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ func newBuild(ctx context.Context, org string, pipeline string, f *factory.Facto
actionErr = fmt.Errorf("Error getting pipeline: %w", err)
return
}

// Check if the pipeline has a default branch set
if p.DefaultBranch == "" {
actionErr = fmt.Errorf("No default branch set for pipeline %s. Please specify a branch using --branch (-b)", pipeline)
return
}
branch = p.DefaultBranch
}

Expand Down

0 comments on commit de985b8

Please sign in to comment.