Skip to content

Commit

Permalink
log worktree status when checkout fails
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Hall <[email protected]>
  • Loading branch information
imjasonh committed Dec 16, 2024
1 parent b9a25d1 commit 7086ffa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/github-bots/sdk/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,11 @@ func (c GitHubClient) CloneRepo(ctx context.Context, ref, destDir string) (*git.
Branch: plumbing.ReferenceName(ref),
Force: true, // There should not be any local changes, but just in case.
}); err != nil {
status, serr := wt.Status()
if serr != nil {
return nil, fmt.Errorf("failed to get worktree status after failed checkout: %w", errors.Join(serr, err))
}
log.With("status", status).Error("failed checkout")
return nil, fmt.Errorf("failed to checkout ref %s: %w", ref, err)
}
return r, nil
Expand Down

0 comments on commit 7086ffa

Please sign in to comment.