diff --git a/drone/repo/repo_info.go b/drone/repo/repo_info.go index b78eded..db1a42c 100644 --- a/drone/repo/repo_info.go +++ b/drone/repo/repo_info.go @@ -56,4 +56,7 @@ Private: {{ .Private }} Trusted: {{ .Trusted }} Protected: {{ .Protected }} Remote: {{ .HTTPURL }} +CancelRunning: {{ .CancelRunning }} +CancelPulls: {{ .CancelPulls }} +CancelPush: {{ .CancelPush }} ` diff --git a/drone/repo/repo_update.go b/drone/repo/repo_update.go index 5374f09..4ff1fd3 100644 --- a/drone/repo/repo_update.go +++ b/drone/repo/repo_update.go @@ -52,6 +52,10 @@ var repoUpdateCmd = cli.Command{ Name: "auto-cancel-pushes", Usage: "automatically cancel pending push builds", }, + cli.BoolFlag{ + Name: "auto-cancel-running", + Usage: "automatically cancel running builds if newer commit pushed", + }, cli.StringFlag{ Name: "config", Usage: "repository configuration path (e.g. .drone.yml)", @@ -80,18 +84,19 @@ func repoUpdate(c *cli.Context) error { } var ( - visibility = c.String("visibility") - config = c.String("config") - timeout = c.Duration("timeout") - trusted = c.Bool("trusted") - throttle = c.Int64("throttle") - protected = c.Bool("protected") - ignoreForks = c.Bool("ignore-forks") - ignorePulls = c.Bool("ignore-pull-requests") - cancelPulls = c.Bool("auto-cancel-pull-requests") - cancelPush = c.Bool("auto-cancel-pushes") - buildCounter = c.Int64("build-counter") - unsafe = c.Bool("unsafe") + visibility = c.String("visibility") + config = c.String("config") + timeout = c.Duration("timeout") + trusted = c.Bool("trusted") + throttle = c.Int64("throttle") + protected = c.Bool("protected") + ignoreForks = c.Bool("ignore-forks") + ignorePulls = c.Bool("ignore-pull-requests") + cancelPulls = c.Bool("auto-cancel-pull-requests") + cancelPush = c.Bool("auto-cancel-pushes") + cancelRunning = c.Bool("auto-cancel-running") + buildCounter = c.Int64("build-counter") + unsafe = c.Bool("unsafe") ) patch := new(drone.RepoPatch) @@ -123,6 +128,9 @@ func repoUpdate(c *cli.Context) error { if c.IsSet("auto-cancel-pushes") { patch.CancelPush = &cancelPush } + if c.IsSet("auto-cancel-running") { + patch.CancelRunning = &cancelRunning + } if c.IsSet("visibility") { switch visibility { case "public", "private", "internal":