diff --git a/commands/refresh_github_commits.go b/commands/refresh_github_commits.go index 89a26a15f0..5aeac7b6b3 100644 --- a/commands/refresh_github_commits.go +++ b/commands/refresh_github_commits.go @@ -7,6 +7,7 @@ package commands import ( "cocoon/db" "encoding/json" + "fmt" "io/ioutil" "golang.org/x/net/context" @@ -40,6 +41,10 @@ func RefreshGithubCommits(cocoon *db.Cocoon, inputJSON []byte) (interface{}, err return nil, err } + if githubResp.StatusCode != 200 { + return nil, fmt.Errorf("GitHub API responded with a non-200 HTTP status: %v", githubResp.StatusCode) + } + defer githubResp.Body.Close() commitData, err := ioutil.ReadAll(githubResp.Body)