githubactions

package
v0.3.0-20260812175937-... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README

GitHub Actions BuildRunner

githubactions implements buildrunner.BuildRunner with GitHub Actions workflow_dispatch. It is intended to prove the SubmitQueue BuildRunner architecture against a common CI system without adding local state.

Its HTTP client and GitHub Actions-specific facts (run status/conclusion vocabulary, run id encoding) live in platform/githubactions, shared with stovepipe's own GitHub Actions backend.

How it works

  1. Trigger dispatches the configured workflow on a trusted ref, usually main, and returns GitHub's workflow run ID as the SubmitQueue build ID.
  2. SubmitQueue passes these workflow inputs:
    • sq_base_uris
    • sq_head_uris
    • sq_queue
    • sq_metadata
  3. Status calls GitHub's get-workflow-run endpoint with that run ID.
  4. Cancel calls GitHub's cancel-workflow-run endpoint with that run ID.

Minimal workflow

Create a workflow on the target repository's default branch:

name: SubmitQueue CI
run-name: SubmitQueue ${{ inputs.sq_queue }}

on:
  workflow_dispatch:
    inputs:
      sq_base_uris:
        required: true
        type: string
      sq_head_uris:
        required: true
        type: string
      sq_queue:
        required: true
        type: string
      sq_metadata:
        required: false
        type: string

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Inspect SubmitQueue payload
        run: |
          echo '${{ inputs.sq_base_uris }}'
          echo '${{ inputs.sq_head_uris }}'
          echo '${{ inputs.sq_queue }}'
      # Prototype: add a script here that applies sq_base_uris, then
      # sq_head_uris, then runs the repository's real CI command.

The workflow definition should live on a trusted ref. The untrusted changes should be represented by sq_base_uris and sq_head_uris and applied inside the job.

Integrator configuration

A server wiring this backend should provide the GitHub API client and runner configuration equivalent to:

BUILD_RUNNER=githubactions
GITHUB_BASE_URL=https://api.github.com
GITHUB_TOKEN=<token with actions:read/actions:write>
GITHUB_ACTIONS_OWNER=uber
GITHUB_ACTIONS_REPO=submitqueue
GITHUB_ACTIONS_WORKFLOW=submitqueue-ci.yml
GITHUB_ACTIONS_REF=main
GITHUB_ACTIONS_EXTRA_INPUTS=runner=ubuntu-latest,test_command=make test

GITHUB_ACTIONS_REF defaults to main. GITHUB_ACTIONS_EXTRA_INPUTS is optional comma-separated key=value data copied into every dispatch request; use it for workflow-specific knobs like runner labels or test commands.

Practical setup notes

  • Use a trusted workflow definition from the target repository's default branch.
  • Keep workflow permissions minimal. The job may apply untrusted changes before running tests, so avoid broad secrets in this workflow.
  • The backend proves the BuildRunner architecture. It does not prescribe how your workflow materializes sq_base_uris and sq_head_uris; wire that to the repository's existing patch/PR application logic.

Documentation

Overview

Package githubactions implements buildrunner.BuildRunner backed by GitHub Actions workflow_dispatch.

The runner dispatches a trusted workflow and passes SubmitQueue's base/head change URIs as workflow inputs. Trigger returns the GitHub workflow run ID; Status and Cancel use that ID to call GitHub's workflow-run endpoints.

Index

Constants

View Source
const (
	// InputKeyBaseURIs carries the JSON-encoded ordered list of change URIs
	// from dependency batches.
	InputKeyBaseURIs = "sq_base_uris"
	// InputKeyHeadURIs carries the JSON-encoded ordered list of change URIs
	// from the batch under test.
	InputKeyHeadURIs = "sq_head_uris"
	// InputKeyQueue carries the SubmitQueue queue name.
	InputKeyQueue = "sq_queue"
	// InputKeyMetadata carries caller-supplied BuildMetadata as JSON.
	InputKeyMetadata = "sq_metadata"
)

Variables

This section is empty.

Functions

func NewBuildRunner

func NewBuildRunner(params Params) buildrunner.BuildRunner

NewBuildRunner constructs a GitHub Actions-backed BuildRunner bound to one repository/workflow and one queue config.

Types

type Params

type Params struct {
	// Config holds the per-queue identity for this BuildRunner.
	Config buildrunner.Config
	// Client is a pre-constructed GitHub Actions client, bound to one
	// repository and workflow. The wiring layer builds it once via
	// platformgithubactions.NewClient, with the GitHub API root (via
	// platform/http.BaseURLTransport) and auth already configured.
	Client *platformgithubactions.Client
	// Resolver resolves a batch's changes (base and head batches).
	Resolver changeset.Resolver
	// Logger is the structured logger.
	Logger *zap.SugaredLogger
	// Ref is the branch, tag, or SHA where the trusted workflow is read from.
	// Defaults to "main".
	Ref string
	// ExtraInputs are copied into every workflow_dispatch request. Reserved
	// sq_* inputs managed by this package override conflicting keys.
	ExtraInputs map[string]string
}

Params holds the dependencies for a GitHub Actions BuildRunner. The wiring layer is responsible for supplying non-nil Client/Logger; a nil value panics on first use rather than being validated here.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL