Skip to content

Commit

Permalink
fix: default preview branch name to local git branch
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge committed Dec 4, 2023
1 parent d095dfa commit fa77be5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ var (
}

branchCreateCmd = &cobra.Command{
Use: "create <name>",
Use: "create [name]",
Short: "Create a preview branch",
Long: "Create a preview branch for the linked project.",
Args: cobra.ExactArgs(1),
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return create.Run(cmd.Context(), args[0], branchRegion.Value, afero.NewOsFs())
},
Expand Down
4 changes: 4 additions & 0 deletions internal/branches/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ func Run(ctx context.Context, name, region string, fsys afero.Fs) error {
return err
}
gitBranch := keys.GetGitBranchOrDefault("", fsys)
if len(name) == 0 {
name = gitBranch
}

resp, err := utils.GetSupabase().CreateBranchWithResponse(ctx, ref, api.CreateBranchJSONRequestBody{
BranchName: name,
GitBranch: &gitBranch,
Expand Down

0 comments on commit fa77be5

Please sign in to comment.