# Forgejo and Gitea Actions

Run Forgejo Actions and Gitea Actions jobs on Groundbox: Codeberg, or any Forgejo or Gitea you host yourself. Each job gets a fresh VM and a runner made for it alone, billed per second at the same prices as GitHub Actions jobs. You change one line in a workflow.

## Connect an instance

1. On the instance, open **Settings > Applications** and make an access token: `write:repository` for one repository, `write:organization` for an organization, or `write:admin` (an administrator) for the whole instance.
2. In the dashboard, open **Repos and runners > Forgejo / Gitea > Connect Forgejo or Gitea**. Give the address (`https://codeberg.org` unless you host your own), what to take jobs from, and the token.

Groundbox checks the token with the instance and keeps it encrypted. It works out whether the address is Forgejo or Gitea by itself.

```
groundbox ci forgejo connect --repo acme/web --token-stdin < token.txt
groundbox ci forgejo connect https://git.example.com --org acme --token-stdin < token.txt
groundbox ci forgejo
groundbox ci forgejo disconnect <id>
```

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

## Use it

```
# .forgejo/workflows/test.yml (or .gitea/workflows/test.yml)
on: [push, pull_request]
jobs:
  test:
    runs-on: groundbox-4vcpu
    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. Other jobs stay on your own runners.

## How a job runs

- Groundbox asks the instance for waiting jobs every few seconds.
- For each job with a Groundbox size it registers an ephemeral runner on the instance, starts a VM and runs `forgejo-runner` (or `gitea-runner` on Gitea) in it for that one job. On Forgejo 15 and later the runner asks for exactly that job.
- Steps run directly on Ubuntu 24.04 with the same tools as our GitHub Actions runners, as `runs-on: ubuntu-latest` would. Docker is there for steps that use it.
- When the job ends the VM is destroyed and the runner removed from the instance. Your access token never enters the VM: it gets only its runner's own credentials.

## Logs and results

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

## Limits

- The instance must be reachable over HTTPS from the internet.
- Forgejo 11 or later, or Gitea 1.24 or later: older servers have no API to list waiting jobs.
- Linux only. Live logs, the terminal on a job and test insights are for GitHub Actions jobs only for now.
- On Gitea, and on Forgejo before 15, a runner takes the next waiting job with its label, which may be another of yours than the one it was started for. Every job still gets one VM.
