# GitHub Action

> From README.md at modelpin 0.5.7: https://github.com/samarthputhraya/modelpin/blob/v0.5.7/README.md

Commit `modelpin.yaml`, `scenarios/` and `.modelpin/baseline-<model>.json`, then add
`.github/workflows/modelpin.yml`:

```yaml
name: Modelpin

on:
  pull_request:             # did MY change (a prompt, a model id) break it?
  workflow_dispatch:        # run by hand the day a provider ships a new model
  schedule:
    - cron: "0 9 * * 1"     # re-check the same candidate weekly (Mondays 09:00 UTC)

permissions:
  contents: read
  pull-requests: write      # lets the action post its report as a PR comment

jobs:
  model-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: samarthputhraya/modelpin@v1
        with:
          to: gpt-4.1             # the candidate model to vet
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}   # from repository secrets
```

The action installs Modelpin, runs `modelpin check`, posts (and updates in place) a PR comment
with the report, and fails the job on a regression (exit `1`), an unmeasurable run (`3`) or a
setup error (`4`) — with an annotation saying which.

Inputs: `to` (required), `from`, `provider` (defaults to `modelpin.yaml`), `config`,
`scenarios-dir`, `runs`, `match`, `confirm`, `baseline` (record a fresh baseline first),
`comment`, `fail-on-regression`, `github-token`, `modelpin-spec`, `python-version`,
`working-directory`. Outputs: `verdict-exit-code`, `report-path`. More:
[`actions/README.md`](https://github.com/samarthputhraya/modelpin/blob/main/actions/README.md).

Things GitHub does that are worth knowing: scheduled workflows run only on the default branch,
in a public repository GitHub disables them after 60 days without activity, pull requests from
forks get no repository secrets (so the check exits `4` there), and a scheduled run needs your
baseline model to still be available if you record baselines in CI.
