Run your GitHub Actions jobs in Hatchet backed by Sandboxes and Serverless Endpoints. Put runs-on: hatchet in a workflow and every job gets a fresh sandbox and a just-in-time GitHub runner. The control logic is a durable task on a Hatchet serverless endpoint deployed as a Cloudflare Worker.
- Your GitHub App sends a
workflow_jobwebhook to a Hatchet incoming webhook. - Hatchet turns the
queuedevent into a run ofgithub-actions-on-jobon your Worker. For a job with thehatchetlabel it starts thegithub-actions-run-jobdurable task, tagged with the repo, workflow, job and run URL. - The task mints a just-in-time runner config with an installation token of your App, creates a sandbox from the official
actions/actions-runnerimage, startsdockerd, and startsrun.sh --jitconfig. - The task sleeps until GitHub sends the matching
completedevent, checking every few minutes that the runner is still alive, then deletes the sandbox.
GitHub keeps the logs and the status checks. Hatchet keeps a run per job with the sandbox turns as children. Filter the runs list by the github.repo or github.job metadata to find a job, and follow github.job_url on the run to its GitHub page.
This repository has an example GitHub Actions workflow that runs on the operator.
-
A Hatchet Cloud tenant with
ServerlessandSandboxesturned on underSettings>Labs Preview. -
A sandbox provider added under
Sandboxes. Archil is the only provider that runs an arbitrary OCI image. Use this config and change the region as needed.{"region":"aws-us-east-1","workdir":"/home/runner"}On Daytona, E2B or Freestyle build a snapshot from
ghcr.io/actions/actions-runner:2.338.2and setSANDBOX_TEMPLATEto its name. -
Node 24, pnpm, and a Cloudflare account with
wrangler logindone.
pnpm install
cp .dev.vars.example .dev.varsPut your Hatchet token in .dev.vars and run the setup once. It creates the Hatchet webhook and prints the webhook URL and secret for the next step.
pnpm registerCreate a GitHub App under your account or organization at Settings > Developer settings > GitHub Apps > New GitHub App.
- Webhook. Active, with the URL and secret from step 1.
- Repository permissions.
Actionsread-only andAdministrationread and write. Nothing else. - Subscribe to events.
Workflow jobs. The checkbox appears onceActionsis granted. - Where can this GitHub App be installed. Only on this account, unless others should install it too.
- Leave
Request user authorization (OAuth) during installationoff. The App needs no callback URL.
Create it, note the App ID, generate a private key and download the .pem. Then install the App on the repositories that should run on Hatchet.
Click the button above. Cloudflare copies this repository into your GitHub account, asks for the secrets listed in .dev.vars.example, and deploys the Worker. Generate HATCHET_SIGNING_SECRET with openssl rand -hex 32. Paste the private key as is, or with \n in place of line breaks.
Or deploy from the clone.
wrangler secret put HATCHET_CLIENT_TOKEN
wrangler secret put HATCHET_SIGNING_SECRET
wrangler secret put GITHUB_APP_ID
wrangler secret put GITHUB_APP_PRIVATE_KEY < app.private-key.pem
wrangler secret put SANDBOX_PROVIDER
pnpm deployFill in HATCHET_SIGNING_SECRET in .dev.vars and run the setup again with the Worker URL. It adds the serverless endpoint and leaves the webhook alone.
pnpm register https://github-actions-operator.<you>.workers.devThen use the label in a workflow.
jobs:
test:
runs-on: hatchet
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: uname -aSecrets are Worker secrets. The rest have defaults under [vars] in wrangler.toml and can be overridden there or as secrets.
| Variable | Meaning |
|---|---|
HATCHET_CLIENT_TOKEN |
Your Hatchet API token. |
HATCHET_SIGNING_SECRET |
32+ characters. The endpoint's signing secret in Hatchet, set by pnpm register. |
GITHUB_APP_ID |
The App ID from the App's settings page. |
GITHUB_APP_PRIVATE_KEY |
The App's private key in PEM form. |
RUNNER_LABEL |
Jobs whose labels do not include it are skipped. Default hatchet. |
SANDBOX_TEMPLATE |
Image or provider snapshot for the sandbox. Default ghcr.io/actions/actions-runner:2.338.2. |
SANDBOX_PROVIDER |
Provider name. Required when the tenant has more than one. |
SANDBOX_VCPU, SANDBOX_MEMORY_MIB |
Sandbox size. Omit for the provider default. |
JOB_TIMEOUT |
The sandbox is deleted after this even if GitHub never reports the job done. Default 6h. |
KEEPALIVE_INTERVAL |
How often the task checks that the runner is still alive. Keep it under the provider's max idle TTL, which defaults to 15 minutes. Default 5m. |