Skip to content

Commit

Permalink
attempt to set git config with passed token
Browse files Browse the repository at this point in the history
  • Loading branch information
monsagri committed Jan 15, 2025
1 parent 71054e9 commit 396ba6b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,18 @@ func getPullRequestDiffUsingGitCommand(ctx context.Context, config *lcr.Config,
}

mergeBaseSha := commitsComparison.GetMergeBaseCommit().GetSHA()
for _, sha := range []string{mergeBaseSha, headSha} {
gha.Debug("PR %d: running git fetch --depth=1 %s %s", number, head.GetRepo().GetHTMLURL(), sha)
_, err := exec.Command("git", "config", "--global", "credential.helper", "store", os.Getenv("GITHUB_TOKEN")).CombinedOutput()
if err != nil {
return nil, fmt.Errorf("failed to run git config: %w", err)
}

_, err = exec.Command("git", "fetch", "--depth=1", head.GetRepo().GetHTMLURL(), sha).CombinedOutput()
if err != nil {
return nil, fmt.Errorf("failed to run git fetch: %w", err)
}
}

bytes, err := exec.Command("git", "diff", "--find-renames", mergeBaseSha, headSha).CombinedOutput()
if err != nil {
Expand Down

0 comments on commit 396ba6b

Please sign in to comment.