Premia
CLI

CI integration

Run Premia from GitHub Actions and gate on the result.

The CLI is CI-native: authenticate with a token env var and use --wait / --json so a run's result drives your pipeline.

GitHub Actions

- name: Trigger a Premia run
  env:
    PREMIA_TOKEN: ${{ secrets.PREMIA_TOKEN }}
  run: |
    npx @premia/cli run "apply migration for issue #${{ github.event.issue.number }}" \
      --wait

--wait blocks until the run and its children finish and exits non-zero on failure, so the step fails your workflow if Premia's run failed.

Want the id for later steps?

RUN_ID=$(npx @premia/cli run "…" --json | jq -r '.run_id')
npx @premia/cli runs logs "$RUN_ID" --follow

Tokens for CI

Create a token in Settings → API Keys and store it as a repository/organization secret named PREMIA_TOKEN. The token acts as you within one organization; revoke it anytime from the same page.

Exit codes

CodeMeaning
0Success
1Run failed / command error
2Auth error
3Not found
130Interrupted

On this page