mirror of
https://github.com/goreleaser/goreleaser.git
synced 2024-12-31 01:53:50 +02:00
fix: Silent failure caused by branching logic
Changed the branching after the `GetContents` call to *first* check for a non-404 error (internal failure of some sort) and then proceed to check the status to determine whether to `CreateFile` or `UpdateFile`.
This commit is contained in:
parent
f8a7ac602e
commit
0a37305745
@ -63,7 +63,11 @@ func (c *githubClient) CreateFile(
|
||||
path,
|
||||
&github.RepositoryContentGetOptions{},
|
||||
)
|
||||
if err != nil && res.StatusCode == 404 {
|
||||
if err != nil && res.StatusCode != 404 {
|
||||
return
|
||||
}
|
||||
|
||||
if res.StatusCode == 404 {
|
||||
_, _, err = c.client.Repositories.CreateFile(
|
||||
ctx,
|
||||
repo.Owner,
|
||||
@ -71,16 +75,16 @@ func (c *githubClient) CreateFile(
|
||||
path,
|
||||
options,
|
||||
)
|
||||
return
|
||||
} else {
|
||||
options.SHA = file.SHA
|
||||
_, _, err = c.client.Repositories.UpdateFile(
|
||||
ctx,
|
||||
repo.Owner,
|
||||
repo.Name,
|
||||
path,
|
||||
options,
|
||||
)
|
||||
}
|
||||
options.SHA = file.SHA
|
||||
_, _, err = c.client.Repositories.UpdateFile(
|
||||
ctx,
|
||||
repo.Owner,
|
||||
repo.Name,
|
||||
path,
|
||||
options,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user