GitHub Action
Free CI integration: flag breaking API changes on every pull request, inline.
How it works
The oasdiff/oasdiff-action/breaking Action runs on pull requests and compares your API spec in the PR branch against the spec on the base branch. Breaking changes show up inline in the "Files changed" tab as ::error:: annotations, and in a pull-request comment that lists them. No sign-up and no oasdiff account: the breaking-change detection runs in your CI. When the side-by-side review is enabled (the default) the action uploads the comparison to oasdiff.com; set review: false to keep everything inside your CI.
Want a rich PR comment with approve/reject and a commit-status check that blocks merge until breaking changes are signed off? See the oasdiff Pro setup guide. Pro is the same action with your token added.
Inline GitHub annotations
The breaking action automatically emits ::error:: annotations that GitHub displays inline on the changed files in a pull request, no sign-up required. When changes are found it also uploads the comparison and links to a full side-by-side review (the review input, on by default). The two specs are encrypted in CI before upload, so we never see them (how it works); set review: false to skip the upload. When the job grants pull-requests: write (as below), the action posts a comment that lists the changes and links to the review; without it, and on fork pull requests where the token is read-only, the link goes to the job summary. How to use the review.
name: oasdiff
on:
pull_request:
branches: [ "main" ]
permissions:
contents: read
pull-requests: write
jobs:
breaking-changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: git fetch --depth=1 origin ${{ github.base_ref }}
- uses: oasdiff/oasdiff-action/breaking@v0
with:
base: 'origin/${{ github.base_ref }}:openapi.yaml'
revision: 'HEAD:openapi.yaml'
fail-on: WARNReplace openapi.yaml with the path to your OpenAPI spec file.
Inputs
| Input | Default | Description |
|---|---|---|
| base | (required) | The base (old) OpenAPI spec: a file path, a URL, or a git ref such as origin/main:openapi.yaml |
| revision | (required) | The revised (new) OpenAPI spec, in the same forms |
| fail-on | "" | Fail the job when a change is at or above this severity: ERR or WARN, or MISSING-VERSION-BUMP to fail only when breaking changes come without a major version increase. Empty never fails. This is policy rather than a fact about the run: once you have a .oasdiff.yaml, set it there |
| oasdiff-token | "" | Your oasdiff Pro token: adds the approval workflow and the merge gate to this same action |
| github-token | github.token | Token used to post the comment. The default is the job's own token, so you only need to grant pull-requests: write. Set it to an empty string to keep the review link in the job summary only |
| review | true | Upload the encrypted comparison and link to the side-by-side review. Set false so that no spec leaves CI |
| config | "" | Path to an oasdiff config file, when .oasdiff.yaml is not at the repository root |
| output-to-file | "" | Also write the report to this file |
| composed | false | Run in composed mode (glob patterns for multiple spec files) |
| allow-external-refs | false | Resolve external $refs. Off by default to prevent SSRF on untrusted pull requests |
These inputs describe the run, with one exception: fail-on is policy, and is an input so that a workflow can block a merge without a second file. How oasdiff judges the API (the severity that fails the job, ignore files, severity levels, exclusions, deprecation windows and every other oasdiff flag) goes in .oasdiff.yaml, below. The changelog action is the same action reporting every change instead of only the breaking ones, and takes the same inputs. The diff action prints the full diff, and the validate action runs against a single spec (no base / revision split), failing the workflow when the spec violates OpenAPI or JSON Schema rules. See the full reference on GitHub →
Configuring with .oasdiff.yaml
Each action automatically picks up a .oasdiff.yaml file from the root of the checked-out repository. Keep CLI-flag-shaped configuration in source control instead of repeating the same with: block in every workflow.
# .oasdiff.yaml at the repo root
fail-on: ERR
exclude-elements:
- description
- title
- summary
err-ignore: ./oasdiff-err-ignore.txtAction with: inputs override values in the file. The legacy oasdiff.yaml filename (no leading dot) still works as a back-compat fallback.
For a config outside the repo root, point the config input at it. For the full list of supported keys, see the oasdiff configuration-file reference.