# GitHub Actions

A minimal workflow that gates every pull request on the cooldown. It installs the prebuilt binary from the GitHub release with [mise](https://mise.jdx.dev), then runs the gate:

```yaml {title=".github/workflows/cooldown.yaml"}
name: cooldown
on:
  pull_request:
  push:
    branches: [main]

jobs:
  cooldown:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: jdx/mise-action@v5
        with:
          mise_toml: |
            [tools]
            "github:romnn/cooldown" = "latest"
      # Ignore the local cache so the gate can't pass on a stale publish time.
      - run: cooldown check --fresh
```

`cooldown check` exits non-zero on a violation, which fails the job. The gate reads the committed lockfiles, but it first runs each tool's own lock check, such as `uv lock --check` or `npm ci --dry-run`, so the runner also needs the package manager of every ecosystem it gates. Add them to the same `mise_toml`; when one is missing, `check` exits `4`.

## Scoping the gate

In a polyglot repository you can gate one ecosystem per job, or all at once:

```yaml
      - run: cooldown check --fresh --tool cargo
      - run: cooldown check --fresh --tool uv,npm
```

Splitting into separate jobs gives you independent status checks (a red Rust gate and a green Python gate are distinguishable at a glance).

## Softening transitive noise

By default the gate fails on a too-fresh **transitive** dependency, because the resolved graph is the real risk surface. If you'd rather see those but not block on the ones you can't act on, keep them visible and non-fatal:

```yaml
      - run: cooldown check --fresh --transitive allow
```

The strict default is opt-out, never opt-in — see [`check`](https://romnn.github.io/cooldown/docs/commands/check/).

## Nightly "what's adoptable" report

Separate from the gate, a scheduled job can surface updates that have matured, without failing anything:

```yaml {title=".github/workflows/adoptable.yaml"}
name: adoptable
on:
  schedule:
    - cron: "0 6 * * 1"      # Monday mornings
  workflow_dispatch:

jobs:
  outdated:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: jdx/mise-action@v5
        with:
          mise_toml: |
            [tools]
            "github:romnn/cooldown" = "latest"
      # Exit 1 only if something is adoptable, so the run's status reflects it.
      - run: cooldown outdated --fresh --no-major --exit-code
```

Two flags shape the report:

- **`--exit-code`:** turns the informational [`outdated`](https://romnn.github.io/cooldown/docs/commands/outdated/) into a soft signal.
- **`--no-major`:** keeps cross-major bumps from nagging every week.

## JSON for other tooling

Every command takes `--json`, so a workflow can post results elsewhere. The schema is printed by [`cooldown schema`](https://romnn.github.io/cooldown/docs/commands/other/):

```yaml
      - run: cooldown check --fresh --json > cooldown.json
```
