1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-11-30 08:06:52 +02:00

Add support for "drone build start foo/bar last"

This starts the build on the default branch
This commit is contained in:
Trevor Hartman 2016-08-11 16:57:22 -06:00
parent e28d85292a
commit 358243ed07

View File

@ -35,16 +35,28 @@ func buildStart(c *cli.Context) (err error) {
if err != nil {
return err
}
number, err := strconv.Atoi(c.Args().Get(1))
if err != nil {
return err
}
client, err := newClient(c)
if err != nil {
return err
}
buildArg := c.Args().Get(1)
var number int
if buildArg == "last" {
// Fetch the build number from the last build
build, err := client.BuildLast(owner, name, "")
if err != nil {
return err
}
number = build.Number
} else {
number, err = strconv.Atoi(buildArg)
if err != nil {
return err
}
}
params := parseKVPairs(c.StringSlice("param"))
var build *model.Build