Documentation
¶
Index ¶
- func ParseJobResults(data []byte, deployNames []string) (map[string]string, error)
- func ParseJobResultsForEnv(data []byte, deployNames []string, targetEnv string) (map[string]string, error)
- func QueryJobResults(repo, runID string, deployNames []string) (map[string]string, error)
- type Job
- type JobsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseJobResults ¶
ParseJobResults parses the GitHub Actions jobs API response and extracts deploy job conclusions. It handles both simple job names ("Deploy infra") and matrix job names ("Deploy infra (test)").
For matrix jobs, it returns the first matching result. To get results for a specific environment in a matrix job, use ParseJobResultsForEnv instead.
Jobs that don't exist in the response default to "skipped". Jobs with null conclusions (in_progress/queued) also default to "skipped".
func ParseJobResultsForEnv ¶
func ParseJobResultsForEnv(data []byte, deployNames []string, targetEnv string) (map[string]string, error)
ParseJobResultsForEnv parses job results with optional environment filtering for matrix jobs. When targetEnv is provided, it only matches jobs with that environment in parentheses. For example, targetEnv="uat" will match "Deploy infra (uat)" but not "Deploy infra (test)".
When targetEnv is empty, it matches the first occurrence of each deploy name.
func QueryJobResults ¶
QueryJobResults queries GitHub Actions for job results from a specific workflow run. It uses the gh CLI to query the GitHub API and returns a map of deploy names to their conclusions.
Parameters:
- repo: GitHub repository in the format "owner/name"
- runID: The GitHub Actions workflow run ID
- deployNames: List of deploy names to look for (e.g., ["infra", "app"])
Returns a map of deploy name to conclusion ("success", "failure", "skipped", etc.)
Types ¶
type Job ¶
type Job struct {
Name string `json:"name"`
Conclusion *string `json:"conclusion"` // Nullable - null when job is in_progress/queued
}
Job represents a single GitHub Actions job.
type JobsResponse ¶
type JobsResponse struct {
Jobs []Job `json:"jobs"`
}
JobsResponse represents the response from the GitHub Actions jobs API.