Documentation
¶
Index ¶
- Variables
- func ExtractBaseRepo(repoPath string) string
- func FindGitRoot() (string, error)
- func FindGitRootFrom(startDir string) (string, error)
- func IsAuthError(errMsg string) bool
- func IsHexString(s string) bool
- func IsRateLimitError(errMsg string) bool
- func IsValidFullSHA(s string) bool
- func ReadFileFromHEAD(filePath, gitRoot string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotGitRepository = errors.New("not in a git repository")
Functions ¶
func ExtractBaseRepo ¶ added in v0.51.7
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"
func FindGitRoot ¶ added in v0.51.7
FindGitRoot finds the root directory of the git repository. Uses pure Go filesystem traversal to avoid requiring the git executable, which can fail when the binary runs under Rosetta 2 on macOS ARM64 or in environments where git is not on PATH. Returns an error if not in a git repository.
func FindGitRootFrom ¶ added in v0.72.2
FindGitRootFrom finds the root directory of the git repository starting from the given directory. It traverses upward until it finds a .git entry (file or directory) or reaches the filesystem root. Returns an error if not in a git repository.
func IsAuthError ¶
IsAuthError checks if an error message indicates an authentication issue. This is used to detect when GitHub API calls fail due to missing or invalid credentials.
func IsHexString ¶
IsHexString checks if a string contains only hexadecimal characters. This is used to validate Git commit SHAs and other hexadecimal identifiers.
func IsRateLimitError ¶ added in v0.64.1
IsRateLimitError checks if an error message indicates a GitHub API rate limit error. This is used to detect transient failures caused by hitting the GitHub API rate limit (HTTP 403 "API rate limit exceeded" or HTTP 429 responses).
func IsValidFullSHA ¶ added in v0.69.0
IsValidFullSHA checks if s is a valid 40-character lowercase hexadecimal SHA.
func ReadFileFromHEAD ¶ added in v0.67.3
ReadFileFromHEAD reads a file from git HEAD using a pre-computed repository root. filePath is resolved with filepath.Abs, so relative paths are interpreted from the current process working directory (not gitRoot). Prefer passing an absolute path within gitRoot, such as filepath.Join(gitRoot, "path/to/file"). Use this when the caller already knows the git root (e.g. from a cached value).
Types ¶
This section is empty.