GetCommit fetches the Commit object for a given SHA. GitHub API docs: https://docs.github.com/rest/git/commits?apiVersion=2022-11-28#get-a-commit-object meta:operation GET /repos/{owner}/{repo}/git/commits/{commit_sha}
(ctx context.Context, owner, repo, sha string)
| 86 | // |
| 87 | //meta:operation GET /repos/{owner}/{repo}/git/commits/{commit_sha} |
| 88 | func (s *GitService) GetCommit(ctx context.Context, owner, repo, sha string) (*Commit, *Response, error) { |
| 89 | u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha) |
| 90 | req, err := s.client.NewRequest(ctx, "GET", u, nil) |
| 91 | if err != nil { |
| 92 | return nil, nil, err |
| 93 | } |
| 94 | |
| 95 | var c *Commit |
| 96 | resp, err := s.client.Do(req, &c) |
| 97 | if err != nil { |
| 98 | return nil, resp, err |
| 99 | } |
| 100 | |
| 101 | return c, resp, nil |
| 102 | } |
| 103 | |
| 104 | // createCommit represents the body of a CreateCommit request. |
| 105 | type createCommit struct { |