diff --git a/cli/deploy/deploy.go b/cli/deploy/deploy.go index 71ba9401fdb..d5786e110df 100644 --- a/cli/deploy/deploy.go +++ b/cli/deploy/deploy.go @@ -30,7 +30,7 @@ import ( // Command exports the deploy command. var Command = &cli.Command{ Name: "deploy", - Usage: "deploy code", + Usage: "trigger a pipeline with the 'deployment' event", ArgsUsage: " ", Action: deploy, Flags: []cli.Flag{ @@ -38,7 +38,6 @@ var Command = &cli.Command{ &cli.StringFlag{ Name: "branch", Usage: "branch filter", - Value: "main", }, &cli.StringFlag{ Name: "event", @@ -74,6 +73,15 @@ func deploy(c *cli.Context) error { event := c.String("event") status := c.String("status") + if branch == "" { + repo, err := client.Repo(repoID) + if err != nil { + return err + } + + branch = repo.DefaultBranch + } + pipelineArg := c.Args().Get(1) var number int64 if pipelineArg == "last" { diff --git a/cli/pipeline/pipeline.go b/cli/pipeline/pipeline.go index f596538cb3b..27044cac342 100644 --- a/cli/pipeline/pipeline.go +++ b/cli/pipeline/pipeline.go @@ -77,7 +77,7 @@ func pipelineOutput(c *cli.Context, resources []woodpecker.Pipeline, fd ...io.Wr fallthrough default: table := output.NewTable(out) - cols := []string{"Number", "Status", "Event", "Branch", "Commit", "Author"} + cols := []string{"Number", "Status", "Event", "Branch", "Message", "Author"} if len(outOpt) > 0 { cols = outOpt diff --git a/cli/pipeline/pipeline_test.go b/cli/pipeline/pipeline_test.go index 7850c01b83b..3ff2080ae78 100644 --- a/cli/pipeline/pipeline_test.go +++ b/cli/pipeline/pipeline_test.go @@ -22,7 +22,7 @@ func TestPipelineOutput(t *testing.T) { { name: "table output with default columns", args: []string{}, - expected: "NUMBER STATUS EVENT BRANCH COMMIT AUTHOR\n1 success push main abcdef John Doe\n", + expected: "NUMBER STATUS EVENT BRANCH MESSAGE AUTHOR\n1 success push main message John Doe\n", }, { name: "table output with custom columns", @@ -32,7 +32,7 @@ func TestPipelineOutput(t *testing.T) { { name: "table output with no header", args: []string{"output", "--output-no-headers"}, - expected: "1 success push main abcdef John Doe\n", + expected: "1 success push main message John Doe\n", }, { name: "go-template output", @@ -48,12 +48,12 @@ func TestPipelineOutput(t *testing.T) { pipelines := []woodpecker.Pipeline{ { - Number: 1, - Status: "success", - Event: "push", - Branch: "main", - Commit: "abcdef", - Author: "John Doe", + Number: 1, + Status: "success", + Event: "push", + Branch: "main", + Message: "message", + Author: "John Doe", }, }