Skip to content

Commit

Permalink
Add head variable
Browse files Browse the repository at this point in the history
  • Loading branch information
massongit committed Apr 18, 2024
1 parent 20801bc commit 8a69338
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions service/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ func (g *PullRequest) diffUsingGitCommand(ctx context.Context) ([]byte, error) {
return nil, err
}

headSha := pr.GetHead().GetSHA()
head := pr.GetHead()
headSha := head.GetSHA()

commitsComparison, _, err := g.cli.Repositories.CompareCommits(ctx, g.owner, g.repo, headSha, pr.GetBase().GetSHA(), nil)
if err != nil {
Expand All @@ -335,7 +336,8 @@ func (g *PullRequest) diffUsingGitCommand(ctx context.Context) ([]byte, error) {

if _, err := exec.Command("git", "remote", "get-url", remoteRepo).CombinedOutput(); err != nil {
log.Printf("failed to run git remote get-url: %s", err)

Check warning on line 338 in service/github/github.go

View check run for this annotation

Codecov / codecov/patch

service/github/github.go#L337-L338

Added lines #L337 - L338 were not covered by tests
_, err := exec.Command("git", "remote", "add", remoteRepo, pr.GetHead().GetRepo().GetHTMLURL()).CombinedOutput()

_, err := exec.Command("git", "remote", "add", remoteRepo, head.GetRepo().GetHTMLURL()).CombinedOutput()
if err != nil {
return nil, fmt.Errorf("failed to run git remote add: %w", err)

Check warning on line 342 in service/github/github.go

View check run for this annotation

Codecov / codecov/patch

service/github/github.go#L340-L342

Added lines #L340 - L342 were not covered by tests
}
Expand Down

0 comments on commit 8a69338

Please sign in to comment.