Documentation
¶
Index ¶
- func CommitURL(repo, sha string) string
- func DownloadArtifact(ctx context.Context, repo string, artifactID int64, outputDir string) (string, error)
- func JobURL(repo, runID, jobID string) string
- func RunDownload(ctx context.Context, runID string, opts RunDownloadOptions) error
- func RunURL(repo, runID string) string
- type Artifact
- type Commit
- type CommitAuthor
- type CommitDetails
- type CommitFile
- type Conclusion
- type Job
- type Run
- type RunDownloadOptions
- type RunListOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadArtifact ¶
func DownloadArtifact(ctx context.Context, repo string, artifactID int64, outputDir string) (string, error)
DownloadArtifact downloads a single GitHub Actions artifact zip file.
func RunDownload ¶
func RunDownload(ctx context.Context, runID string, opts RunDownloadOptions) error
RunDownload executes `gh run download`.
Types ¶
type Artifact ¶
type Artifact struct {
ID int64 `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
Expired bool `json:"expired"`
}
Artifact represents a downloadable GitHub Actions artifact.
type Commit ¶
type Commit struct {
SHA string `json:"sha"`
Commit CommitDetails `json:"commit"`
Files []CommitFile `json:"files"`
}
Commit holds changed-file info fetched from the GitHub API.
func GetCommit ¶
GetCommit fetches commit metadata from the GitHub API. Uses: GET /repos/{owner}/{repo}/commits/{sha}
type CommitAuthor ¶
CommitAuthor holds the commit author nested in the GitHub API response.
type CommitDetails ¶
type CommitDetails struct {
Message string `json:"message"`
Author CommitAuthor `json:"author"`
}
CommitDetails holds the commit metadata nested in the GitHub API response.
type CommitFile ¶
type CommitFile struct {
Filename string `json:"filename"`
}
CommitFile holds a changed file in the GitHub API response.
type Conclusion ¶
type Conclusion string
Conclusion represents the conclusion status of a workflow run or job.
const ( ConclusionSuccess Conclusion = "success" ConclusionFailure Conclusion = "failure" )
type Job ¶
type Job struct {
Name string `json:"name"`
Conclusion Conclusion `json:"conclusion"`
Status string `json:"status"`
StartedAt string `json:"startedAt"`
CompletedAt string `json:"completedAt"`
URL string `json:"url"`
}
Job represents a single job in a GitHub Actions workflow run returned by the gh CLI.
type Run ¶
type Run struct {
DatabaseID int64 `json:"databaseId"`
Number int `json:"number"`
Name string `json:"name"`
WorkflowName string `json:"workflowName"`
WorkflowDatabaseID int64 `json:"workflowDatabaseId"`
Status string `json:"status"`
Conclusion Conclusion `json:"conclusion"`
HeadBranch string `json:"headBranch"`
HeadSHA string `json:"headSha"`
URL string `json:"url"`
DisplayTitle string `json:"displayTitle"`
Event string `json:"event"`
CreatedAt time.Time `json:"createdAt"`
StartedAt time.Time `json:"startedAt"`
UpdatedAt time.Time `json:"updatedAt"`
Duration time.Duration `json:"-"`
Jobs []Job `json:"jobs"`
}
Run represents a GitHub Actions workflow run returned by the gh CLI.
func ListRuns ¶
func ListRuns(ctx context.Context, opts RunListOptions) ([]Run, error)
ListRuns retrieves workflow runs through the gh CLI.
type RunDownloadOptions ¶
RunDownloadOptions configures `gh run download`.