Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneRepository ¶
func CloneRepository(session GithubSessionInterface, repository_url, workdir, branch string, basicAuth *ghhttp.BasicAuth, gitCloneOptions *git.CloneOptions, ) (*git.Repository, error)
CloneRepository clones the specified GitHub repository into a local directory named "/work". It uses the provided GithubSession for authentication and clones the specific branch indicated in the data map. repository_url: The URL of the GitHub repository to clone. Requires https:// format. branch: The branch to clone from the repository. Do not include the "refs/heads/" prefix, just the branch name. gitCloneOptions: Optional git clone options. If nil, default options will be used. basicAuth: Optional basic authentication credentials. If nil, it will use the token from the session. Returns a pointer to the cloned git.Repository or an error if the clone operation fails.
func CreateCheckRun ¶
func CreateCheckRun( ctx context.Context, s GithubSessionInterface, headSha, repo, org, name, title, conclusion, status, summary string, ) error
CreateCheckRun creates a check run in the specified GitHub repository. It uses the provided GithubSession for authentication and requires the head SHA, repository name, organization name, check run name, title, conclusion, status, and summary. headSha: The SHA of the commit to create the check run for. repo: The name of the repository where the check run will be created. org: The name of the organization that owns the repository. name: The name of the check run. title: The title of the check run. conclusion: The conclusion of the check run (e.g., "success", "failure"). status: The status of the check run (e.g., "queued", "in_progress", "completed"). summary: A summary of the check run results. Returns an error if the check run creation fails.
Types ¶
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