# GitCafe Actions

Run GitCafe Actions jobs on Groundbox. GitCafe runs your `.github/workflows` with the same YAML as GitHub, and sends a runner pool's jobs to a runner provider: connect a pool to Groundbox and each of its jobs gets a fresh VM and a runner made for it alone, billed per second at the same prices as GitHub Actions jobs.

## Connect a pool

1. In GitCafe, make a runner pool for your organization of kind **provider**, with the labels your jobs will ask for: `groundbox-4vcpu`, or each Groundbox size you use. (Over GitCafe's API: `POST /api/orgs/{org}/actions/pools/` with `{"kind": "provider", "labels": [...]}`.)
2. Make the pool's provider token (`gcp_...`). It can only read the pool's queued jobs and start runners in it. (Over the API: `POST /api/orgs/{org}/actions/pools/{pool}/provider-tokens`.)
3. In the dashboard, open **Repos and runners > GitCafe > Connect a GitCafe pool** and give the token.

Groundbox checks the token with GitCafe and keeps it encrypted. It is never shown again.

```
groundbox ci gitcafe connect --org acme --token-stdin < token.txt
groundbox ci gitcafe
groundbox ci gitcafe disconnect <id>
```

The API has the same at `GET`, `POST /v1/ci/gitcafe/connections` and `DELETE /v1/ci/gitcafe/connections/{id}` (an API key with `ci:read` to list, `ci:write` to connect and disconnect), and the SDKs as `list_gitcafe_connections`, `connect_gitcafe` and `disconnect_gitcafe`.

## Use it

```
# .github/workflows/test.yml on GitCafe
jobs:
  test:
    runs-on: groundbox-4vcpu   # or groundbox for the auto size
    steps:
      - uses: actions/checkout@v4
      - run: npm ci && npm test
```

A job whose `runs-on` is a Groundbox size runs on Groundbox: `groundbox-2vcpu`, `groundbox-4vcpu`, `groundbox-8vcpu`, `groundbox-16vcpu`, or `groundbox` for the auto size. The pool needs the same label. Other jobs stay where they ran before.

## How a job runs

- Groundbox reads the pool's queued jobs every few seconds.
- For each job with a Groundbox size it asks GitCafe for a just-in-time runner bound to that job, starts a VM and runs GitHub's own runner in it with that runner's credentials. The runner takes that one job and unregisters itself.
- Steps run on Ubuntu 24.04 with the same tools as our GitHub Actions runners. Docker is there for steps, containers and services that use it.
- When the job ends the VM is destroyed. Your provider token never enters the VM.

## Logs and results

The job's log, status and cancel button are GitCafe's own. The dashboard and `groundbox ci runs` list each job with its time, cost and result.

## Limits

- Linux x64 only for now.
- A job canceled in GitCafe before its VM starts is dropped here too. Once it runs, cancel it in GitCafe as usual: the runner stops the job.
