ExtractBaseRepo extracts the base repository (owner/repo) from a repository path that may include subfolders. For "actions/checkout" -> "actions/checkout" For "github/codeql-action/upload-sarif" -> "github/codeql-action"
(repoPath string)
| 70 | // For "actions/checkout" -> "actions/checkout" |
| 71 | // For "github/codeql-action/upload-sarif" -> "github/codeql-action" |
| 72 | func ExtractBaseRepo(repoPath string) string { |
| 73 | parts := strings.Split(repoPath, "/") |
| 74 | if len(parts) >= 2 { |
| 75 | return parts[0] + "/" + parts[1] |
| 76 | } |
| 77 | return repoPath |
| 78 | } |
| 79 | |
| 80 | // FindGitRoot finds the root directory of the git repository. |
| 81 | // Uses pure Go filesystem traversal to avoid requiring the git executable, |
no outgoing calls