Skip to content

Commit

Permalink
Add repo context to error message when branch is not found (integrati…
Browse files Browse the repository at this point in the history
…ons#691)

* Add repo context to error message when branch is not found

* fix failing `TestAccGithubRepositoryFile` test

access committer data through `Commit` struct

Co-authored-by: Jeremy Udit <jcudit@github.com>
  • Loading branch information
mbarany and Jeremy Udit authored Feb 10, 2021
1 parent cd3b41b commit 1f810d8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions github/resource_github_repository_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ func resourceGithubRepositoryFileRead(d *schema.ResourceData, meta interface{})
}

d.Set("commit_sha", commit.GetSHA())
d.Set("commit_author", commit.GetCommitter().GetName())
d.Set("commit_email", commit.GetCommitter().GetEmail())
d.Set("commit_author", commit.Commit.GetCommitter().GetName())
d.Set("commit_email", commit.Commit.GetCommitter().GetEmail())
d.Set("commit_message", commit.GetCommit().GetMessage())

return nil
Expand Down Expand Up @@ -335,7 +335,7 @@ func checkRepositoryBranchExists(client *github.Client, owner, repo, branch stri
if err != nil {
if ghErr, ok := err.(*github.ErrorResponse); ok {
if ghErr.Response.StatusCode == http.StatusNotFound {
return fmt.Errorf("Branch %s not found in repository or repository is not readable", branch)
return fmt.Errorf("Branch %s not found in repository %s/%s or repository is not readable", branch, owner, repo)
}
}
return err
Expand Down

0 comments on commit 1f810d8

Please sign in to comment.