Documentation
¶
Index ¶
- func CloneRepository(session GithubSessionInterface, options CloneOptions) (*git.Repository, error)
- func CloneRepositorySimple(session GithubSessionInterface, repositoryURL, workDir, branch string) (*git.Repository, error)
- func CloneRepositoryWithAuth(session GithubSessionInterface, repositoryURL, workDir, branch string, ...) (*git.Repository, error)
- func CommitAllChangesWithToken(repo *git.Repository, branch, message string, githubAccessToken string) (string, error)
- func CommitChanges(repo *git.Repository, options CommitOptions) (string, error)
- func CommitChangesWithToken(repo *git.Repository, branch, message string, files []string, ...) (string, error)
- func CreateCheckRun(ctx context.Context, session GithubSessionInterface, options CheckRunOptions) error
- func CreateCheckRunSimple(ctx context.Context, session GithubSessionInterface, ...) error
- type AuthorInfo
- type CheckRunOptions
- type CloneOptions
- type CommitOptions
- type GithubConfig
- type GithubSession
- type GithubSessionInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneRepository ¶
func CloneRepository(session GithubSessionInterface, options CloneOptions) (*git.Repository, error)
CloneRepository clones the specified GitHub repository with the provided options
func CloneRepositorySimple ¶ added in v1.3.11
func CloneRepositorySimple(session GithubSessionInterface, repositoryURL, workDir, branch string) (*git.Repository, error)
CloneRepositorySimple is a convenience function that clones a repository with basic options
func CloneRepositoryWithAuth ¶ added in v1.3.11
func CloneRepositoryWithAuth( session GithubSessionInterface, repositoryURL, workDir, branch string, auth *ghhttp.BasicAuth, gitOptions *git.CloneOptions, ) (*git.Repository, error)
CloneRepositoryWithAuth is a convenience function that clones a repository with custom authentication
func CommitAllChangesWithToken ¶ added in v1.3.11
func CommitAllChangesWithToken( repo *git.Repository, branch, message string, githubAccessToken string, ) (string, error)
CommitAllChangesWithToken is a convenience function that commits all changes with token authentication
func CommitChanges ¶ added in v1.3.11
func CommitChanges(repo *git.Repository, options CommitOptions) (string, error)
CommitChanges commits changes to the repository with the provided options
func CommitChangesWithToken ¶ added in v1.3.11
func CommitChangesWithToken( repo *git.Repository, branch, message string, files []string, githubAccessToken string, ) (string, error)
CommitChangesWithToken is a convenience function that creates CommitOptions with token authentication
func CreateCheckRun ¶
func CreateCheckRun(ctx context.Context, session GithubSessionInterface, options CheckRunOptions) error
CreateCheckRun creates a check run in the specified GitHub repository with the provided options
func CreateCheckRunSimple ¶ added in v1.3.11
func CreateCheckRunSimple( ctx context.Context, session GithubSessionInterface, headSHA, repo, org, name, title, conclusion, status, summary string, ) error
CreateCheckRunSimple is a convenience function that creates a basic check run
Types ¶
type AuthorInfo ¶ added in v1.3.11
AuthorInfo defines the author information for commits
func GetDefaultAuthor ¶ added in v1.3.11
func GetDefaultAuthor() AuthorInfo
GetDefaultAuthor provides a default author configuration
type CheckRunOptions ¶ added in v1.3.11
type CheckRunOptions struct {
// Required fields
HeadSHA string
Repository string
Org string
Name string
// Optional fields with defaults
Title string
Conclusion string
Status string
Summary string
Text string
// Advanced options
DetailsURL string
ExternalID string
StartedAt *time.Time
CompletedAt *time.Time
Actions []*github.CheckRunAction
Images []*github.CheckRunImage
Annotations []*github.CheckRunAnnotation
}
CheckRunOptions defines the configuration for creating check runs
type CloneOptions ¶ added in v1.3.11
type CloneOptions struct {
// Repository URL to clone
RepositoryURL string
// Local directory to clone into
WorkDir string
// Branch to clone (optional, defaults to default branch)
Branch string
// Authentication credentials (optional, will use session token if not provided)
Auth *ghhttp.BasicAuth
// Git clone options (optional, will use defaults if not provided)
GitCloneOptions *git.CloneOptions
// Progress output (optional, defaults to os.Stdout)
Progress *os.File
// Single branch clone (defaults to true)
SingleBranch bool
// Clone depth (defaults to 1 for shallow clone)
Depth int
}
CloneOptions defines the configuration for cloning repositories
func DefaultCloneOptions ¶ added in v1.3.11
func DefaultCloneOptions() CloneOptions
DefaultCloneOptions provides sensible defaults for cloning
type CommitOptions ¶ added in v1.3.11
type CommitOptions struct {
// Branch to commit to
Branch string
// Commit message
Message string
// Files to add to the commit (if empty, will add all changes)
Files []string
// Add all changes if true, otherwise only add specified files
AddAll bool
// Author information
Author AuthorInfo
// Authentication for pushing
Auth *ghhttp.BasicAuth
// Remote URL (optional, will use existing remote if not specified)
RemoteURL string
// Remote name (defaults to "origin")
RemoteName string
}
CommitOptions defines the configuration for committing changes
type GithubConfig ¶
type GithubConfig struct {
Pem string `mapstructure:"pem"`
AppId string `mapstructure:"app_id"`
InstallId string `mapstructure:"install_id"`
}
func GithubLoadConfig ¶
func GithubLoadConfig() (*GithubConfig, error)
type GithubSession ¶
type GithubSession struct {
// contains filtered or unexported fields
}
func NewGithubSession ¶
func NewGithubSession(pem, appID, installID string) (*GithubSession, error)
NewGithubSession creates a new Github session using the provided PEM file, App ID, and Install ID
func (*GithubSession) AuthToken ¶
func (s *GithubSession) AuthToken() *oauth2.Token
Get AuthToken returns the authentication token
func (*GithubSession) Client ¶
func (s *GithubSession) Client() *github.Client
Get Client returns the authenticated Github client