Documentation
¶
Overview ¶
Package git provides a wrapper for git operations.
Index ¶
- type CIStatus
- type CheckStatus
- type CheckSuite
- type Git
- func (g *Git) AllTags() ([]string, error)
- func (g *Git) Commit(message string, sign bool) error
- func (g *Git) CommitAll(message string, sign bool) error
- func (g *Git) CreateTag(tag string, message string, sign bool) error
- func (g *Git) CurrentBranch() (string, error)
- func (g *Git) CurrentCommit() (string, error)
- func (g *Git) DeleteTag(tag string) error
- func (g *Git) Fetch() error
- func (g *Git) FetchTags() error
- func (g *Git) GetCIStatus(ref string) (*CIStatus, error)
- func (g *Git) GetPRForBranch() (int, error)
- func (g *Git) GetPRStatus(prNumber int) (*CIStatus, error)
- func (g *Git) IsAncestor(ancestor, descendant string) (bool, error)
- func (g *Git) IsCIPassing(ref string) (bool, error)
- func (g *Git) IsDirty() (bool, error)
- func (g *Git) LatestTag() (string, error)
- func (g *Git) Log(from, to string, format string) (string, error)
- func (g *Git) Push(refs ...string) error
- func (g *Git) PushTag(tag string) error
- func (g *Git) PushWithUpstream() error
- func (g *Git) RemoteURL() (string, error)
- func (g *Git) ShortCommit() (string, error)
- func (g *Git) Status() (*Status, error)
- func (g *Git) WaitForCI(timeout time.Duration) error
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CIStatus ¶
type CIStatus struct {
State string // "success", "pending", "failure", "error"
TotalCount int // Total number of checks
Statuses []CheckStatus // Individual check statuses
CheckSuites []CheckSuite // GitHub Actions check suites
}
CIStatus represents the combined status of CI checks.
type CheckStatus ¶
type CheckStatus struct {
Context string // Check name/context
State string // "success", "pending", "failure", "error"
Description string // Status description
TargetURL string // URL to check details
}
CheckStatus represents a single status check.
type CheckSuite ¶
type CheckSuite struct {
App string // App name (e.g., "GitHub Actions")
Status string // "queued", "in_progress", "completed"
Conclusion string // "success", "failure", "neutral", etc. (only if completed)
}
CheckSuite represents a GitHub Actions check suite.
type Git ¶
type Git struct {
Dir string // Repository directory
Remote string // Remote name (default: origin)
}
Git provides git operations for a repository.
func (*Git) CurrentBranch ¶
CurrentBranch returns the current branch name.
func (*Git) CurrentCommit ¶
CurrentCommit returns the current commit SHA.
func (*Git) GetCIStatus ¶
GetCIStatus retrieves the CI status for a commit.
func (*Git) GetPRForBranch ¶
GetPRForBranch gets the PR number for the current branch.
func (*Git) GetPRStatus ¶
GetPRStatus gets the CI status for a PR.
func (*Git) IsAncestor ¶
IsAncestor checks if ancestor is an ancestor of descendant.
func (*Git) IsCIPassing ¶
IsCIPassing checks if CI is currently passing (without waiting).
func (*Git) PushWithUpstream ¶
PushWithUpstream pushes the current branch and sets upstream.
func (*Git) ShortCommit ¶
ShortCommit returns the short form of the current commit SHA.
type Status ¶
type Status struct {
Branch string // Current branch name
Ahead int // Commits ahead of remote
Behind int // Commits behind remote
Staged []string // Staged files
Modified []string // Modified but unstaged files
Untracked []string // Untracked files
HasRemote bool // Whether branch has a remote tracking branch
RemoteBranch string // Remote tracking branch
IsClean bool // No uncommitted changes
}
Status represents the current git status.