Documentation
¶
Index ¶
- Variables
- type Api
- func (a Api) DeleteArtifact(artifactID int64) error
- func (a Api) DownloadArtifactDir(runID int64, artifactNameGlob, targetDir string) error
- func (a Api) DownloadBranchArtifactDir(branch, workflowName, artifactName, targetDir string) error
- func (a Api) LatestWorkflowRun(branch, workflowNameGlob string) (WorkflowRun, error)
- func (a Api) ListArtifactsForBranch(branch, workflowNameGlob, artifactNameGlob string) ([]Artifact, error)
- func (a Api) ListArtifactsForWorkflowRun(runID int64, artifactNameGlob string) ([]Artifact, error)
- func (a Api) UploadArtifactDir(baseDir string, opts UploadArtifactOption) (int64, error)
- type Artifact
- type ArtifactList
- type ArtifactWorkflowRun
- type Event
- type HeadCommit
- type Option
- type Param
- type PullRequest
- type Ref
- type Repository
- type Timestamp
- type UploadArtifactOption
- type User
- type WorkflowRun
- type WorkflowRunList
Constants ¶
This section is empty.
Variables ¶
var (
MatrixSuffix = matrixSuffix()
)
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct {
// Token the Authorization: Bearer token to use, defaults to environment variable: GITHUB_TOKEN or `gh auth token`
Token string
// BaseURL base URL to the GitHub API defaults to https://api.github.com
BaseURL string
// Repo is the full GitHub repository, e.g. anchore/syft
Repo string
// Actor is the actor executing the workflow in GitHub, the login, e.g. kzantow
Actor string
}
func NewClient ¶
NewClient creates a new GitHub API client, looking up information automatically from the environment when run in a GitHub Actions runner
func (Api) DeleteArtifact ¶
func (Api) DownloadArtifactDir ¶
DownloadArtifactDir downloads an artifact and extracts it to the targetDir
func (Api) DownloadBranchArtifactDir ¶
DownloadBranchArtifactDir downloads an artifact from the latest run on a branch and extracts it to the targetDir
func (Api) LatestWorkflowRun ¶
func (a Api) LatestWorkflowRun(branch, workflowNameGlob string) (WorkflowRun, error)
LatestWorkflowRun returns the latest completed workflow run for a branch
func (Api) ListArtifactsForBranch ¶
func (a Api) ListArtifactsForBranch(branch, workflowNameGlob, artifactNameGlob string) ([]Artifact, error)
ListArtifactsForBranch returns artifacts for the latest run on the given workflow
func (Api) ListArtifactsForWorkflowRun ¶
func (Api) UploadArtifactDir ¶
func (a Api) UploadArtifactDir(baseDir string, opts UploadArtifactOption) (int64, error)
UploadArtifactDir will compress all files in the basedir into an artifact attached to the currently running workflow. Optionally limit the files by including ArtifactFiles or ArtifactGlob, which can be relative to the baseDir. To specify a custom name, use ArtifactName
type Artifact ¶
type Artifact struct {
ID int64 `json:"id,omitempty"`
NodeID string `json:"node_id,omitempty"`
Name string `json:"name,omitempty"`
SizeInBytes int64 `json:"size_in_bytes,omitempty"`
URL string `json:"url,omitempty"`
ArchiveDownloadURL string `json:"archive_download_url,omitempty"`
Expired bool `json:"expired,omitempty"`
CreatedAt Timestamp `json:"created_at,omitempty"`
UpdatedAt Timestamp `json:"updated_at,omitempty"`
ExpiresAt Timestamp `json:"expires_at,omitempty"`
Digest string `json:"digest,omitempty"`
WorkflowRun ArtifactWorkflowRun `json:"workflow_run,omitempty"`
}
type ArtifactList ¶
type ArtifactWorkflowRun ¶
type Event ¶
type Event struct {
ApiURL string `env:"GITHUB_API_URL"`
Token string `env:"GITHUB_TOKEN"`
Type string `env:"GITHUB_EVENT_NAME"`
Ref string `env:"GITHUB_REF"`
Actor string `env:"GITHUB_ACTOR"`
Owner string `env:"GITHUB_REPOSITORY_OWNER"`
Repo string `env:"GITHUB_REPOSITORY"` // Repo is the full name of the repository, including the owner
SHA string `env:"GITHUB_SHA"`
Workflow string `env:"GITHUB_WORKFLOW"`
RunID int64 `env:"GITHUB_RUN_ID"`
RunNumber string `env:"GITHUB_RUN_NUMBER"`
Job string `env:"GITHUB_JOB"`
Step string `env:"GITHUB_STEP"`
Action string `env:"GITHUB_ACTION"`
PullRequest PullRequest `json:"pull_request"`
}
func (Event) IsPullRequest ¶
type HeadCommit ¶
type HeadCommit struct {
ID string `json:"id,omitempty"`
}
type PullRequest ¶
type Repository ¶
type Repository struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Name string `json:"name"`
FullName string `json:"full_name"`
Private bool `json:"private"`
Owner User `json:"owner"`
HTMLURL string `json:"html_url"`
Description string `json:"description"`
Fork bool `json:"fork"`
URL string `json:"url"`
}
type Timestamp ¶
func (*Timestamp) UnmarshalJSON ¶
type UploadArtifactOption ¶
type WorkflowRun ¶
type WorkflowRun struct {
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
NodeID string `json:"node_id,omitempty"`
HeadBranch string `json:"head_branch,omitempty"`
HeadSHA string `json:"head_sha,omitempty"`
Path string `json:"path,omitempty"`
RunNumber int `json:"run_number,omitempty"`
RunAttempt int `json:"run_attempt,omitempty"`
Event string `json:"event,omitempty"`
DisplayTitle string `json:"display_title,omitempty"`
Status string `json:"status,omitempty"`
Conclusion string `json:"conclusion,omitempty"` // success or failure
WorkflowID int64 `json:"workflow_id,omitempty"`
CheckSuiteID int64 `json:"check_suite_id,omitempty"`
CheckSuiteNodeID string `json:"check_suite_node_id,omitempty"`
URL string `json:"url,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
PullRequests []PullRequest `json:"pull_requests,omitempty"`
CreatedAt Timestamp `json:"created_at,omitempty"`
UpdatedAt Timestamp `json:"updated_at,omitempty"`
RunStartedAt Timestamp `json:"run_started_at,omitempty"`
PreviousAttemptURL string `json:"previous_attempt_url,omitempty"`
HeadCommit HeadCommit `json:"head_commit,omitempty"`
Repository Repository `json:"repository,omitempty"`
HeadRepository Repository `json:"head_repository,omitempty"`
Actor User `json:"actor,omitempty"`
TriggeringActor User `json:"triggering_actor,omitempty"`
}
type WorkflowRunList ¶
type WorkflowRunList struct {
TotalCount int64 `json:"total_count,omitempty"`
WorkflowRuns []WorkflowRun `json:"workflow_runs,omitempty"`
}