{"modulePath":"github.com/uber/submitqueue","version":"v0.3.0-20260812015054-61db11ff9a0d","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package githubactions\n\nPackage githubactions provides the HTTP client and GitHub Actions-specific facts (run status/conclusion vocabulary and run id encoding) shared by every domain's GitHub Actions-backed BuildRunner. It intentionally holds no BuildRunner interface or domain entity types — each domain (submitqueue, stovepipe, ...) defines its own BuildRunner and its own BuildStatus, and adapts this package's RunStatus to it. See platform/extension/buildrunner/buildkite's README for the analogous rationale applied to the Buildkite backend.\n\n## Variables\n\n```go\nvar ErrNotFound = errors.New(\"githubactions: resource not found\")\n```\nErrNotFound is returned when the GitHub Actions API responds with 404 to a request for a resource by ID (e.g. GetRun on an unknown run, or CancelRun on an already-deleted run).\n\n## Functions\n\n```go\nfunc EncodeRunID(runID int64) string\n```\nEncodeRunID encodes a GitHub Actions workflow run id as an opaque build id string.\n\n```go\nfunc ParseRunID(id string) (int64, error)\n```\nParseRunID is the inverse of EncodeRunID.\n\n```go\nfunc RunMetadata(run WorkflowRun) map[string]string\n```\nRunMetadata builds the caller-facing metadata map for a workflow run: the run's own identity and outcome fields, keyed for direct use as (or merge into) a domain's BuildMetadata.\n\n## Types\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\nClient is a thin wrapper around the GitHub Actions REST endpoints a BuildRunner needs: workflow dispatch, get workflow run, and cancel run. It is bound to a single repository and workflow.\n\n```go\nfunc NewClient(httpClient *http.Client, owner, repo, workflowID string) *Client\n```\nNewClient wraps a pre-configured \\*http.Client as a GitHub Actions Client bound to one repository and workflow. The caller is responsible for base URL resolution (e.g. via platform/http.BaseURLTransport, typically \"[https://api.github.com](https://api.github.com)\") and auth (a token with actions:read/actions:write injected via a transport).\n\n```go\nfunc (c *Client) CancelRun(ctx context.Context, runID int64) error\n```\nCancelRun requests cancellation of the workflow run. Returns nil when the run is already terminal or otherwise not cancellable (HTTP 409/422) — the BuildRunner contract treats that as a no-op.\n\n```go\nfunc (c *Client) DispatchWorkflow(ctx context.Context, req DispatchWorkflowRequest) (DispatchWorkflowResponse, error)\n```\nDispatchWorkflow dispatches the bound workflow.\n\nDispatching is not idempotent and a rejection carries its status code like any other, so a caller that retries a 502 can start a second run when the first was already accepted. Callers that cannot tolerate that need their own idempotency check.\n\n```go\nfunc (c *Client) GetRun(ctx context.Context, runID int64) (WorkflowRun, error)\n```\nGetRun fetches a workflow run by its GitHub run id.\n\n```go\nfunc (c *Client) Owner() string\n```\nOwner is the repository owner or organization this Client is bound to.\n\n```go\nfunc (c *Client) Repo() string\n```\nRepo is the repository name this Client is bound to.\n\n```go\nfunc (c *Client) WorkflowID() string\n```\nWorkflowID is the workflow file name or numeric workflow ID this Client is bound to.\n\n```go\ntype DispatchWorkflowRequest struct {\n\tRef              string            `json:\"ref\"`\n\tReturnRunDetails bool              `json:\"return_run_details,omitempty\"`\n\tInputs           map[string]string `json:\"inputs,omitempty\"`\n}\n```\nDispatchWorkflowRequest is the payload for POST .../dispatches.\n\n```go\ntype DispatchWorkflowResponse struct {\n\tWorkflowRunID int64  `json:\"workflow_run_id\"`\n\tRunURL        string `json:\"run_url\"`\n\tHTMLURL       string `json:\"html_url\"`\n}\n```\nDispatchWorkflowResponse is the subset of fields callers need from a dispatch-workflow response.\n\n```go\ntype RunStatus string\n```\nRunStatus is GitHub Actions' own run status/conclusion vocabulary, collapsed into the five states every domain's BuildStatus already distinguishes.\n\n```go\nconst (\n\t// RunStatusUnknown is returned for a raw status/conclusion pair this\n\t// package does not recognize. Not terminal — callers should keep polling\n\t// rather than treat it as a final outcome.\n\tRunStatusUnknown RunStatus = \"\"\n\t// RunStatusAccepted means the run has been accepted for execution but has\n\t// not started yet (GitHub: queued, requested, waiting, pending).\n\tRunStatusAccepted RunStatus = \"accepted\"\n\t// RunStatusRunning means the run is currently executing (GitHub:\n\t// in_progress).\n\tRunStatusRunning RunStatus = \"running\"\n\t// RunStatusSucceeded means the run completed successfully (GitHub:\n\t// completed with conclusion success).\n\tRunStatusSucceeded RunStatus = \"succeeded\"\n\t// RunStatusFailed means the run completed without a passing result\n\t// (GitHub: completed with any conclusion other than success/cancelled).\n\tRunStatusFailed RunStatus = \"failed\"\n\t// RunStatusCancelled means the run was cancelled (GitHub: completed with\n\t// conclusion cancelled).\n\tRunStatusCancelled RunStatus = \"cancelled\"\n)\n```\n\n```go\nfunc ParseRunStatus(status, conclusion string) RunStatus\n```\nParseRunStatus maps a raw GitHub Actions run status/conclusion pair to a RunStatus. conclusion is only consulted when status is \"completed\". An unrecognized status, or a completed run with an empty conclusion, maps to RunStatusUnknown rather than being assumed terminal.\n\n```go\ntype WorkflowRun struct {\n\tID           int64  `json:\"id\"`\n\tName         string `json:\"name\"`\n\tDisplayTitle string `json:\"display_title\"`\n\tStatus       string `json:\"status\"`\n\tConclusion   string `json:\"conclusion\"`\n\tHTMLURL      string `json:\"html_url\"`\n\tRunAttempt   int    `json:\"run_attempt\"`\n\tEvent        string `json:\"event\"`\n\tHeadBranch   string `json:\"head_branch\"`\n\tCreatedAt    string `json:\"created_at\"`\n}\n```\nWorkflowRun is the subset of a GitHub Actions workflow run object callers need.\n\n","path":"github.com/uber/submitqueue/platform/extension/buildrunner/githubactions","name":"githubactions","synopsis":"Package githubactions provides the HTTP client and GitHub Actions-specific facts (run status/conclusion vocabulary and run id encoding) shared by every domain's GitHub Actions-backed BuildRunner.","isRedistributable":true}
