mirror of
https://github.com/drone/drone-cli.git
synced 2024-05-27 01:06:02 +02:00
CLI update to allows patching of the build counter
This commit is contained in:
parent
ee3fd53a95
commit
6b2a6350ce
|
@ -36,6 +36,14 @@ var repoUpdateCmd = cli.Command{
|
|||
Name: "config",
|
||||
Usage: "repository configuration path (e.g. .drone.yml)",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "build-counter",
|
||||
Usage: "repository starting build number",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "unsafe",
|
||||
Usage: "validate updating the build-counter is unsafe",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -57,6 +65,8 @@ func repoUpdate(c *cli.Context) error {
|
|||
timeout = c.Duration("timeout")
|
||||
trusted = c.Bool("trusted")
|
||||
gated = c.Bool("gated")
|
||||
buildCounter = c.Int("build-counter")
|
||||
unsafe = c.Bool("unsafe")
|
||||
)
|
||||
|
||||
patch := new(drone.RepoPatch)
|
||||
|
@ -79,6 +89,12 @@ func repoUpdate(c *cli.Context) error {
|
|||
patch.Visibility = &visibility
|
||||
}
|
||||
}
|
||||
if c.IsSet("build-counter") && !unsafe {
|
||||
fmt.Printf("Setting the build counter is an unsafe operation that could put your repository in an inconsistent state. Please use --unsafe to proceed")
|
||||
}
|
||||
if c.IsSet("build-counter") && unsafe {
|
||||
patch.BuildCounter = & buildCounter
|
||||
}
|
||||
|
||||
if _, err := client.RepoPatch(owner, name, patch); err != nil {
|
||||
return err
|
||||
|
|
|
@ -46,6 +46,7 @@ type (
|
|||
AllowPush *bool `json:"allow_push,omitempty"`
|
||||
AllowDeploy *bool `json:"allow_deploy,omitempty"`
|
||||
AllowTag *bool `json:"allow_tag,omitempty"`
|
||||
BuildCounter *int `json:"build_counter,omitempty"`
|
||||
}
|
||||
|
||||
// Build defines a build object.
|
||||
|
|
Loading…
Reference in New Issue