> ## Documentation Index
> Fetch the complete documentation index at: https://docs.proofpod.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CI and automation

> Run ProofPod from CI, servers and agents with an API token.

## Authenticate with a token

`pp login` needs a browser. In CI, on a server, or for an agent, use an API
token.

Create one from the [dashboard](https://proofpod.dev/app/#/tokens) or from a
machine that is already signed in:

```console theme={null}
$ pp token create github-actions
pp_3f9a2c1b4d5e_8c7e…
proofpod: this token is shown once. Use it as PROOFPOD_TOKEN in CI.
```

Then set `PROOFPOD_TOKEN` in the job's environment. It takes precedence over
any stored credentials.

```console theme={null}
$ pp token list
$ pp token revoke 3f9a2c1b4d5e
```

## Share a workspace between jobs

CI runners are usually fresh machines, and by default every machine gets its own
workspace, so every job would start with an empty build cache. Give the
workspace a name instead:

```console theme={null}
$ pp --workspace myproject-main lake build
```

All jobs using that name share one workspace: sources are synced as a diff from
whatever the previous job left, and Lake only rebuilds what changed.

Use one name per line of development that should share a cache. A name per
branch (`myproject-${BRANCH}`) is a good default; a single shared name is fine
if jobs do not overlap. A workspace runs one command at a time, so jobs that
share a name queue behind each other.

## GitHub Actions

```yaml .github/workflows/lean.yml theme={null}
name: Lean
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      PROOFPOD_TOKEN: ${{ secrets.PROOFPOD_TOKEN }}
      PROOFPOD_WORKSPACE: myproject-${{ github.ref_name }}
    steps:
      - uses: actions/checkout@v4
      - name: Install ProofPod
        run: curl -LsSf https://proofpod.dev/install.sh | sh
      - name: Build
        run: pp --cpu 16 --memory 32G --timeout 2h lake build
      - name: Test
        run: pp lake test
```

The runner itself needs no Lean toolchain, no Mathlib cache and no large
machine: a standard runner spends the job waiting on output.

## Output and exit codes in scripts

* Only the command's own output goes to stdout. ProofPod's messages go to
  stderr.
* When stderr is not a terminal, ProofPod prints warnings and errors only. Add
  `--verbose` to also log sync details, the environment and the cost summary,
  or `--quiet` for nothing but the command's output.
* `pp` exits with the command's exit code. See the full list in the
  [CLI reference](https://docs.proofpod.dev/reference/cli.md#exit-codes).

```bash theme={null}
if pp --quiet lake env lean Candidate.lean > result.txt 2> errors.txt; then
  echo "proof accepted"
fi
```

## Checking many files

A common automation pattern is checking a stream of candidate proofs. Inside a
project:

```console theme={null}
$ pp lake env lean Candidates/Attempt_0412.lean
```

`pp` never reads standard input unless you pass `--stdin`, so it is safe to call
from a loop that is itself reading a list, and from harnesses that leave stdin
open:

```bash theme={null}
while read -r file; do
  pp --quiet lake env lean "$file" || echo "$file" >> failed.txt
done < candidates.txt
```

The sandbox stays warm for two minutes after each command, so consecutive
checks skip the cold start. Each check of a file importing all of Mathlib takes
about 7 seconds and costs about \$0.0002.

Checks in one workspace run one at a time. To run checks in parallel, use
several named workspaces (`--workspace checks-1`, `--workspace checks-2`, …),
up to your account's limit of 8 concurrent commands.

## Fixing versions for reproducibility

By default the cloud follows the project's `lean-toolchain` and
`lake-manifest.json`, which is what you want when both are committed. To pin
regardless of the checkout, set them explicitly:

```toml proofpod.toml theme={null}
lean = "v4.36.0"
mathlib = "v4.36.0"
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.