Documentation
¶
Index ¶
- type Artifact
- type ArtifactCollector
- func (c *ArtifactCollector) DownloadArtifact(ctx context.Context, artifact Artifact) (string, error)
- func (c *ArtifactCollector) GetRepository(ctx context.Context) (*Repository, error)
- func (c *ArtifactCollector) GetWorkflowRun(ctx context.Context) (*WorkflowRun, error)
- func (c *ArtifactCollector) ListArtifacts(ctx context.Context) ([]Artifact, error)
- func (c *ArtifactCollector) ListPullsForCommit(ctx context.Context, sha string) ([]PullRequestRef, error)
- type ArtifactMetadata
- type ArtifactsResponse
- type PullRequestRef
- type Repository
- type User
- type WorkflowRun
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Artifact ¶
type Artifact struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Name string `json:"name"`
SizeInBytes int64 `json:"size_in_bytes"`
URL string `json:"url"`
ArchiveDownloadURL string `json:"archive_download_url"`
Expired bool `json:"expired"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ExpiresAt time.Time `json:"expires_at"`
}
Artifact represents a GitHub Actions artifact
type ArtifactCollector ¶
type ArtifactCollector struct {
// contains filtered or unexported fields
}
ArtifactCollector handles collection of GitHub Actions artifacts
func NewArtifactCollector ¶
func NewArtifactCollector(token, apiURL, repository, runID string) *ArtifactCollector
NewArtifactCollector creates a new artifact collector
func (*ArtifactCollector) DownloadArtifact ¶
func (c *ArtifactCollector) DownloadArtifact(ctx context.Context, artifact Artifact) (string, error)
DownloadArtifact downloads an artifact and extracts it to a temporary directory
func (*ArtifactCollector) GetRepository ¶ added in v3.73.0
func (c *ArtifactCollector) GetRepository(ctx context.Context) (*Repository, error)
GetRepository fetches the repository's metadata.
func (*ArtifactCollector) GetWorkflowRun ¶ added in v3.73.0
func (c *ArtifactCollector) GetWorkflowRun(ctx context.Context) (*WorkflowRun, error)
GetWorkflowRun fetches this run's metadata.
func (*ArtifactCollector) ListArtifacts ¶
func (c *ArtifactCollector) ListArtifacts(ctx context.Context) ([]Artifact, error)
ListArtifacts lists all artifacts for the current workflow run
func (*ArtifactCollector) ListPullsForCommit ¶ added in v3.73.0
func (c *ArtifactCollector) ListPullsForCommit(ctx context.Context, sha string) ([]PullRequestRef, error)
ListPullsForCommit finds the pull requests a commit belongs to. Used on a push to a branch that has an open PR, where the event payload carries no PR number.
type ArtifactMetadata ¶
type ArtifactMetadata struct {
Repository string `json:"repository"`
RepositoryOwner string `json:"repository_owner"`
RunID string `json:"run_id"`
RunNumber string `json:"run_number"`
WorkflowName string `json:"workflow_name"`
JobName string `json:"job"`
SHA string `json:"sha"`
RefName string `json:"ref_name"`
RefType string `json:"ref_type"`
EventName string `json:"event_name"`
Actor string `json:"actor"`
ServerURL string `json:"server_url"`
APIURL string `json:"api_url"`
Artifacts []string `json:"artifacts"`
ExtraEnvVars map[string]string `json:"extra_env_vars,omitempty"`
}
ArtifactMetadata contains metadata about the workflow and artifacts
func CollectMetadata ¶
func CollectMetadata(artifactNames []string) *ArtifactMetadata
CollectMetadata collects metadata from GitHub Actions environment
type ArtifactsResponse ¶
type ArtifactsResponse struct {
TotalCount int `json:"total_count"`
Artifacts []Artifact `json:"artifacts"`
}
ArtifactsResponse represents the GitHub API response for artifacts
type PullRequestRef ¶ added in v3.73.0
type PullRequestRef struct {
Number int `json:"number"`
State string `json:"state"`
Base struct {
Ref string `json:"ref"`
} `json:"base"`
Head struct {
Ref string `json:"ref"`
} `json:"head"`
}
PullRequestRef is one PR a commit belongs to.
type Repository ¶ added in v3.73.0
type Repository struct {
ID int64 `json:"id"`
FullName string `json:"full_name"`
Private bool `json:"private"`
Visibility string `json:"visibility"`
DefaultBranch string `json:"default_branch"`
Owner *User `json:"owner"`
License *struct {
SpdxID string `json:"spdx_id"`
} `json:"license"`
}
Repository is the subset of GET /repos/{repo} worth keeping.
type WorkflowRun ¶ added in v3.73.0
type WorkflowRun struct {
ID int64 `json:"id"`
Name string `json:"name"`
RunNumber int `json:"run_number"`
RunAttempt int `json:"run_attempt"`
Event string `json:"event"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
HeadBranch string `json:"head_branch"`
HeadSHA string `json:"head_sha"`
HTMLURL string `json:"html_url"`
Path string `json:"path"`
Actor *User `json:"actor"`
TriggeringActor *User `json:"triggering_actor"`
PullRequests []struct {
Number int `json:"number"`
} `json:"pull_requests"`
}
WorkflowRun is the subset of GET /repos/{repo}/actions/runs/{id} worth keeping.