# Run it in CI

Let a scheduled job tell you when a workaround can go, through exit codes.

canibump is built to nag. A run that finds something for you exits non-zero, so a cron job or a scheduled workflow turns red the day a fix lands.

## Exit codes

The `--help` says it all in one line.

Exit codes: 0 when nothing counted showed up, else 8 plus 1 for bumpable, 2 for dead, 4 for failed, 16 for an unlisted link or marker and 32 for an unmarked blocker, summed (bumpable and dead is 11). 1 is an unusable manifest or cache, 2 a bad argument. `--fail-on` picks what counts. `status <id>` answers for one blocker instead: 0 bumpable, 1 waiting, 2 anything else.

The codes are bits, so a script can test each one, like `(( code & 2 ))` for something dead.

## Pick what fails

All five statuses count unless you pick. `[settings] fail-on` picks them for every run, and `--fail-on` overrides it for one. `waiting` never counts, and a status that doesn’t count still prints its line.

```
$ canibump --fail-on dead
bumpable  libfoo-crash  github:libfoo/libfoo#412 merged (drop the libfoo crash patch)
waiting   libbar-arm64  gitlab:libbar/libbar!88 is open
dead      widget-leak   codeberg:widget/widget#7 closed without a reason; check it by hand (drop the widget leak workaround)
dead      qux-timeout   jira:issues.example.org#QUX-42 closed as not planned (raise the qux client timeout back to 30s)
bumpable  baz-locale    redmine:redmine.example.org#1234 closed as completed (drop LC_ALL=C from the baz wrapper)
```

Only `dead` counts here, so the run exits `10`, 8 plus 2. `fail-on = []` never fails.

## One blocker in a script

`canibump status <id>` answers for one blocker from the last results, with no network. It exits 0 for `bumpable`, 1 for `waiting` and 2 for anything else, errors included.

```
$ canibump status libfoo-crash && echo "go drop the patch"
bumpable  libfoo-crash  github:libfoo/libfoo#412 merged (drop the libfoo crash patch)
go drop the patch
```

## A weekly workflow

This GitHub workflow checks every Monday and goes red when something wants you. `GITHUB_TOKEN` lifts the rate limit, and [Tokens and hosts](https://mlavrinenko.github.io/canibump/tokens-and-hosts/index.md) covers the other forges.

```yaml
name: canibump
on:
  schedule:
    - cron: "0 6 * * 1"
  workflow_dispatch:
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - run: |
          curl -sSfLo canibump https://github.com/mlavrinenko/canibump/releases/latest/download/canibump-x86_64-unknown-linux-gnu
          chmod +x canibump
      - run: ./canibump
        env:
          GITHUB_TOKEN: ${{ github.token }}
```
