add nil check for create repo response

This commit is contained in:
Anthony Sterling
2020-07-13 13:24:20 +01:00
parent 216045d0eb
commit c6f5906aa1

View File

@@ -93,7 +93,7 @@ func getOrCreateGitHubRepo(ctx context.Context, client *github.Client, repoName,
HasProjects: github.Bool(false),
}
ghRepo, resp, err := client.Repositories.Create(ctx, orgName, repo)
if resp.StatusCode == 422 {
if resp != nil && resp.StatusCode == 422 {
ghRepo, _, err = client.Repositories.Get(ctx, orgName, repoName)
}
if err != nil {