Pull request check

shipnotes check BASE_REF compares your branch with a base branch. CI runs it on every pull request. It fails when the diff needs an entry and has none, when someone edits a version by hand, or when a contract breaks without a major entry.

shipnotes check origin/main

The check compares HEAD with the merge base of BASE_REF and HEAD. It reads committed files only. Commit your changes before you run it locally.

What the check verifies

The check runs these steps in this order. Each error line starts with ✗ and a prefix that names the step. The command exits with status 1 when any step reports an error.

1. The schema at HEAD

The check runs the same validation as shipnotes lint on the files at HEAD. Each problem is an error with the prefix schema:. See Validation.

2. Uncommitted entries

A file under the changelog directory that is not committed is invisible to the check. The check prints a note for each such file:

  changelog/unreleased/export-widgets.yml is not committed, so this check does not see it

A note does not fail the check.

3. Versions and release pull requests

Version files and release files change only through shipnotes release. The check looks for two things:

  • a version file whose version differs from the base, or
  • any change in the releases folder.

If it finds neither, it goes to step 4. If it finds one, it verifies the diff as a release pull request. A valid release prints the note release PR verified and skips step 4. An invalid one fails:

✗ versions: lib/acme_widgets/version.rb changed, but this diff is not a valid release; versions and release files come only from `shipnotes release`
✗ versions: a release adds exactly one release file and changes no other

A release pull request is valid when all of these are true:

  1. It adds exactly one release file and changes no other file in the releases folder.
  2. It adds no unreleased entry.
  3. The new file is a release file: a mapping with release and an entries list.
  4. The release holds exactly the unreleased entries that the diff deletes, with the same content.
  5. With scheme: semver, the release has a version. That version is the one the entries require, or a valid --version choice. See Versioning.
  6. With release_id: version, the release id equals the version.
  7. Every version file holds the release version.
  8. It changes nothing else. Only the release file, its deleted entries, the version files and render.output can change.

Each failed rule is an error with the prefix versions:.

4. The entry rule

The check decides which entries the diff needs. Files under the changelog directory never count.

  • Surfaces. Each surface whose paths match a changed file needs an entry for that surface. A change to a surface’s contract file also counts. exclude removes paths from a surface.
  • always. With require_entry: always, any changed file that does not match check.ignore needs some entry. See check.
  • Triggers. Each trigger whose pattern matches an added or removed line in its paths needs an entry. A trigger with a surface needs an entry for that surface. A trigger without one needs any entry. The check prints trigger: NAME for each match.

Only entries that the diff adds count. An entry that the diff only modifies does not satisfy the rule. An entry satisfies a surface when its surfaces list includes that surface.

  trigger: feature flag
✗ entry: this diff needs a changelog entry (surfaces: api, app); add one with `shipnotes new`

When the diff adds entries but misses a surface, the error names the surface:

✗ entry: this diff changes the app surface; add an entry whose surfaces include app

With --skip-entry or the skip label, the rule does not fail. It prints a note instead:

  entry rule skipped (this diff would need: surfaces: api, app)

5. Breaking contract changes

For each surface with a contract, the check reads the contract file at the base and at HEAD. If the file changed, it runs the differ and prints each finding as a note:

  mcp: BREAKING delete_widget: tool removed
  mcp: change get_widget: tool added

If any finding is breaking, the diff must add an entry that:

  • includes the surface in surfaces (when surfaces are configured), and
  • bumps the major version, through the bump field or through bump: major.
✗ breaking: mcp has 2 breaking change(s); add an entry with surfaces [mcp] that bumps the major version, or undo the change

This step also runs when the entry rule is skipped. A differ that cannot run prints a note and is skipped:

  api: breaking-change diff skipped: oasdiff not found (install it, set OASDIFF or pass --oasdiff)

Contracts and differs describes the differs.

Options

Usage: shipnotes check BASE_REF [--skip-entry] [--skip-label NAME] [--oasdiff PATH]
        --root DIR                   Project root (default: the nearest folder with .shipnotes.yml)
        --skip-entry, --no-entry-required
                                     Do not require an entry (other checks still run)
        --skip-label NAME            Skip the entry rule when the PR has this label (reads labels with gh)
        --oasdiff PATH               oasdiff binary for OpenAPI contracts
    -h, --help                       Show this help
Option Effect
BASE_REF Required. The branch or commit to compare with, for example origin/main.
--skip-entry, --no-entry-required Skips the entry rule. The schema, version and breaking-change steps still run.
--skip-label NAME Skips the entry rule when the pull request has the label NAME. The check prints the NAME label is set.
--oasdiff PATH The oasdiff binary for an openapi contract.
--root DIR The project root. See Project root.

--skip-label reads the labels with the GitHub CLI: gh pr view --json labels. It uses PR_NUMBER and GITHUB_REPOSITORY from the environment when PR_NUMBER is set. Without PR_NUMBER, gh uses the pull request of the current branch. If gh cannot read the labels, the check treats the label as absent and applies the entry rule.

GitHub Actions

changelog:
  if: github.event_name == 'pull_request'
  runs-on: ubuntu-latest
  permissions: { contents: read, pull-requests: read }
  steps:
    - uses: actions/checkout@v4
      with: { fetch-depth: 0 }
    - uses: ruby/setup-ruby@v1
      with: { bundler-cache: true }
    - env:
        GH_TOKEN: ${{ github.token }}
        PR_NUMBER: ${{ github.event.pull_request.number }}
        OASDIFF: /usr/local/bin/oasdiff   # only for an openapi contract
      run: bundle exec shipnotes check "origin/${{ github.base_ref }}" --skip-label no-changelog
  • fetch-depth: 0 fetches the full history. The check needs the base branch and the merge base.
  • GH_TOKEN lets gh read the labels. The job needs pull-requests: read.
  • PR_NUMBER tells gh which pull request to read.
  • OASDIFF is necessary only for an openapi contract. See The openapi differ.

The job reads the labels when it runs. If you add the label later, run the job again.

The core has no runtime dependencies. If your bundle is large, you can skip bundler-cache and run gem install shipnotes instead.

Other CI systems

The check needs three things:

  1. A clone with the full history, or at least the base branch and the merge base.
  2. Ruby 3.2 or later and the shipnotes gem.
  3. The base branch name, for example origin/main.

Run shipnotes check origin/main. --skip-label works only with the GitHub CLI. On another system, read the label yourself and pass --skip-entry when it is set.