Monito CLI

CI Integration

Run Monito from GitHub Actions or a deploy webhook.

Choose an integration

Use the CLI when the pipeline should wait for results and fail on test failure. Use a deploy webhook when a deployment should trigger Monito in the background and leave results in the dashboard.

GitHub Actions with the CLI

Create a long-lived API key:

monito auth login
monito auth create-key --name "GitHub Actions"

Store the printed key as a GitHub Actions secret named MONITO_TOKEN.

name: Monito
 
on:
  pull_request:
  push:
    branches: [main]
 
jobs:
  monito:
    runs-on: ubuntu-latest
    env:
      MONITO_TOKEN: ${{ secrets.MONITO_TOKEN }}
      PROJECT_ID: project_123
    steps:
      - uses: actions/setup-node@v4
        with:
          node-version: 20
 
      - name: Run Monito project
        run: npx -y @monitodev/cli project run "$PROJECT_ID" --wait --json

project run exits with code 1 when any scenario fails, so the workflow fails automatically.

Run one scenario instead:

- name: Run Monito scenario
  env:
    MONITO_TOKEN: ${{ secrets.MONITO_TOKEN }}
  run: npx -y @monitodev/cli scenario run scenario_123 --wait --json

Deploy webhook

Rotate a project webhook secret from an authenticated shell:

MONITO_SESSION_TOKEN=$(monito auth token)
curl -fsS -X POST "https://www.monito.dev/api/projects/$PROJECT_ID/hooks/rotate" \
  -H "Authorization: Bearer $MONITO_SESSION_TOKEN"

The response contains webhookUrl and webhookSecret. Store them as deploy-platform secrets, for example MONITO_WEBHOOK_URL and MONITO_WEBHOOK_SECRET.

Trigger the webhook after deployment:

curl -fsS -X POST "$MONITO_WEBHOOK_URL" \
  -H "Authorization: Bearer $MONITO_WEBHOOK_SECRET"

The webhook returns 202 Accepted once runs are queued. It does not block the deployment for pass/fail results; review the dashboard for the run output.

Run only selected scenarios:

curl -fsS -X POST "$MONITO_WEBHOOK_URL" \
  -H "Authorization: Bearer $MONITO_WEBHOOK_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"scenarioIds":["scenario_123"]}'

On this page