mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
fixed restart client
This commit is contained in:
parent
4215193af9
commit
1dec169812
2 changed files with 11 additions and 8 deletions
|
@ -31,7 +31,7 @@ func (s *CommitService) GetOutput(host, owner, name, branch, sha string) (io.Rea
|
||||||
|
|
||||||
// POST /v1/repos/{host}/{owner}/{name}/branches/{branch}/commits/{commit}?action=rebuild
|
// POST /v1/repos/{host}/{owner}/{name}/branches/{branch}/commits/{commit}?action=rebuild
|
||||||
func (s *CommitService) Rebuild(host, owner, name, branch, sha string) error {
|
func (s *CommitService) Rebuild(host, owner, name, branch, sha string) error {
|
||||||
var path = fmt.Sprintf("/v1/repos/%s/%s/%s/branches/%s/commits/%s", host, owner, name, branch, sha)
|
var path = fmt.Sprintf("/v1/repos/%s/%s/%s/branches/%s/commits/%s?action=rebuild", host, owner, name, branch, sha)
|
||||||
return s.run("POST", path, nil, nil)
|
return s.run("POST", path, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,14 +22,17 @@ func restartCommandFunc(c *cli.Context, client *client.Client) error {
|
||||||
var host, owner, repo, branch, sha string
|
var host, owner, repo, branch, sha string
|
||||||
var args = c.Args()
|
var args = c.Args()
|
||||||
|
|
||||||
if len(args) == 5 {
|
if len(args) != 0 {
|
||||||
host, owner, repo = parseRepo(args[0])
|
host, owner, repo = parseRepo(args[0])
|
||||||
} else {
|
}
|
||||||
host = "unknown"
|
|
||||||
owner = "unknown"
|
switch len(args) {
|
||||||
repo = "unknown"
|
case 2:
|
||||||
branch = "unknown"
|
branch = "master"
|
||||||
sha = "unknown"
|
sha = args[1]
|
||||||
|
case 3,4,5:
|
||||||
|
branch = args[1]
|
||||||
|
sha = args[2]
|
||||||
}
|
}
|
||||||
|
|
||||||
return client.Commits.Rebuild(host, owner, repo, branch, sha)
|
return client.Commits.Rebuild(host, owner, repo, branch, sha)
|
||||||
|
|
Loading…
Reference in a new issue