How to use ClearRun in GitHub Actions

Add one step that runs clearrun score with a threshold. If an answer scores too low, the step exits with code 1 and the check fails.

Last updated

You need a ClearRun API key and a folder of AI answers saved as .txt or .md files. A verified free account can create one developer key.

Steps

  1. Add your key as a secret

    In GitHub, go to Settings, then Secrets and variables, then Actions, and add a repository secret named CLEARRUN_API_KEY.

  2. Add clearrun.config.json

    {
      "paths": ["responses/"],
      "threshold": 70
    }

    Put it at the root of your repo.

  3. Add a workflow file

    Save as .github/workflows/clearrun.yml:

    name: ClearRun
    on: pull_request
    jobs:
      score:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
            with:
              node-version: 20
          - run: npx -y @clearrun/cli@1.2.0 score
            env:
              CLEARRUN_API_KEY: ${{ secrets.CLEARRUN_API_KEY }}
  4. Open a pull request

    The ClearRun check runs.

Good to know

  • Pin the version. Use @clearrun/cli@ plus a version number, not latest.
  • Fork pull requests. GitHub does not pass secrets to workflows from forks. Those runs fail with "No ClearRun API key is configured." Skip the step for forks, or run it only on your own branches.
  • Credits. Every file scored uses credits on every run. Keep responses/ small. See the pricing page.
  • What a pass means. Each answer's confidence was backed by its reasoning above your line. It does not mean the answers are true.