Skip to content

Commit

Permalink
Another bugfix for application repository loaders processor
Browse files Browse the repository at this point in the history
  • Loading branch information
Icikowski committed Apr 28, 2022
1 parent 249695c commit 9e75997
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions application/repos/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ func (l *GitHubRepositoryLoader) LoadRepository(source string) (types.Repository
req.Header.Set("Accept", "application/vnd.github.v3+json")

resp, err := http.DefaultClient.Do(req)
if err != nil {
if err != nil || resp.StatusCode != http.StatusOK {
if err == nil {
err = fmt.Errorf("got status code %d", resp.StatusCode)
}
common.PrintErrorWhileMsg("detecting default branch of", fmt.Sprintf("%s/%s", user, repo), err)
return repository, false
}
Expand All @@ -73,7 +76,10 @@ func (l *GitHubRepositoryLoader) LoadRepository(source string) (types.Repository
req, _ := http.NewRequest(http.MethodGet, url, nil)

resp, err := http.DefaultClient.Do(req)
if err != nil {
if err != nil || resp.StatusCode != http.StatusOK {
if err == nil {
err = fmt.Errorf("got status code %d", resp.StatusCode)
}
common.PrintErrorWhileMsg("loading source", source, err)
return repository, false
}
Expand Down

0 comments on commit 9e75997

Please sign in to comment.