githubactions

package
v0.3.0-20260730200940-... Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

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, error)

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
	// HTTPClient is a pre-configured GitHub API client. The caller is responsible
	// for base URL resolution (e.g. via platform/http.BaseURLTransport) and auth.
	// The token needs actions:write to dispatch/cancel workflows and actions:read
	// to poll status.
	HTTPClient *http.Client
	// Resolver resolves a batch's changes (base and head batches).
	Resolver changeset.Resolver
	// Logger is the structured logger.
	Logger *zap.SugaredLogger
	// Owner is the repository owner or organization, for example "uber".
	Owner string
	// Repo is the repository name, for example "submitqueue".
	Repo string
	// WorkflowID is the workflow file name or numeric workflow ID accepted by
	// the GitHub Actions API, for example "submitqueue-ci.yml".
	WorkflowID string
	// 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 and GitHub workflow identity for a GitHub Actions BuildRunner.

Jump to

Keyboard shortcuts

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