| 70 | } |
| 71 | |
| 72 | func getRepoCommitHash(r clients.RepoClient) (string, error) { |
| 73 | commits, err := r.ListCommits() |
| 74 | if err != nil { |
| 75 | // allow --local repos to still process |
| 76 | if errors.Is(err, clients.ErrUnsupportedFeature) { |
| 77 | return "unknown", nil |
| 78 | } |
| 79 | return "", sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("ListCommits:%v", err.Error())) |
| 80 | } |
| 81 | |
| 82 | if len(commits) == 0 { |
| 83 | return "", errEmptyRepository |
| 84 | } |
| 85 | return commits[0].SHA, nil |
| 86 | } |
| 87 | |
| 88 | func runScorecard(ctx context.Context, |
| 89 | repo clients.Repo, |