From cc2d9f2df45ce6e88495e1119a87b037f469e161 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Wed, 25 Nov 2026 09:54:32 +0200 Subject: [PATCH] Stop passing exclude-elements to breaking and changelog Co-Authored-By: Claude Fable 5.2 --- .github/workflows/test-breaking.yaml | 28 ++++++++++++++++++++++++++++ README.md | 12 +++++------- breaking/action.yml | 2 +- breaking/entrypoint.sh | 4 ++-- changelog/action.yml | 2 +- pr-comment/action.yml | 2 +- pr-comment/entrypoint.sh | 2 +- 7 files changed, 39 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-breaking.yaml b/.github/workflows/test-breaking.yaml index a0b5957..f2e2883 100644 --- a/.github/workflows/test-breaking.yaml +++ b/.github/workflows/test-breaking.yaml @@ -322,6 +322,34 @@ jobs: exit 1 fi + oasdiff_breaking_exclude_elements_ignored: + runs-on: ubuntu-latest + name: Test exclude-elements is warned about, not applied + env: + OASDIFF_ACTION_TEST_EXPECTED_OUTPUT: "1 changes: 1 error, 0 warning, 0 info" + steps: + - name: checkout + uses: actions/checkout@v7 + # oasdiff breaking has no --exclude-elements flag, so forwarding the input + # would fail the run. The action only warns. + - name: Running breaking action with exclude-elements + id: test_exclude_elements + continue-on-error: true + uses: ./breaking + with: + base: 'specs/base.yaml' + revision: 'specs/revision-breaking.yaml' + exclude-elements: 'endpoints' + - name: Assert the run was unaffected + env: + ACTUAL_OUTPUT: ${{ steps.test_exclude_elements.outputs.breaking }} + run: | + output="$ACTUAL_OUTPUT" + if [ "$output" != "$OASDIFF_ACTION_TEST_EXPECTED_OUTPUT" ]; then + echo "Expected output '$OASDIFF_ACTION_TEST_EXPECTED_OUTPUT' (exclude-elements must be ignored, not forwarded) but got '$output'" >&2 + exit 1 + fi + oasdiff_breaking_unresolved_ref: runs-on: ubuntu-latest name: Test a failed comparison is not reported as clean diff --git a/README.md b/README.md index 029ec1c..f3cc19f 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ jobs: | `composed` | `false` | Run in [composed mode](https://github.com/oasdiff/oasdiff/blob/main/docs/COMPOSED.md), comparing globs of spec files | | `allow-external-refs` | `false` | Resolve external `$ref`s. Off by default to prevent SSRF on untrusted pull requests; set `true` if your spec references external URLs you trust | -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 is configuration, and it goes in [`.oasdiff.yaml`](#configuring-with-oasdiffyaml): the severity that fails the job, ignore files, severity levels, `flatten-allof`, `exclude-elements`, `filter-extension`, `include-path-params`, the deprecation windows, and every other oasdiff flag. The inputs of those names that earlier versions documented still work. +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 is configuration, and it goes in [`.oasdiff.yaml`](#configuring-with-oasdiffyaml): the severity that fails the job, ignore files, severity levels, `flatten-allof`, `filter-extension`, `include-path-params`, the deprecation windows, and every other oasdiff flag. The inputs of those names that earlier versions documented still work. ### Generate a changelog @@ -149,7 +149,7 @@ jobs: | `fail-on-diff` | `false` | Fail with exit code 1 if any difference is found | `true`, `false` | | `format` | `yaml` | Output format | `yaml`, `json`, `text` | | `include-path-params` | `false` | Include path parameter names in endpoint matching | `true`, `false` | -| `exclude-elements` | `''` | Exclude certain kinds of changes from the output | `endpoints`, `request`, `response` (comma-separated) | +| `exclude-elements` | `''` | Exclude certain kinds of changes from the output | `description`, `endpoints`, `examples`, `extensions`, `summary`, `tags`, `title` (comma-separated) | | `filter-extension` | `''` | Exclude paths and operations with an OpenAPI Extension matching this expression | regex | | `composed` | `false` | Run in composed mode | `true`, `false` | | `flatten-allof` | `false` | Merge allOf subschemas into a single schema before diff | `true`, `false` | @@ -187,7 +187,7 @@ For a non-blocking, report-only run, leave `fail-on` and set `continue-on-error: ## Configuring with `.oasdiff.yaml` -Action inputs cover what a run needs: which specs to compare and the tokens. Everything about how oasdiff judges the API (the severity that fails the job, ignore files, severity levels, exclusions, deprecation windows) goes in `.oasdiff.yaml`, where every oasdiff flag works and the same file gives you the same answer when you run oasdiff locally. +Action inputs cover what a run needs: which specs to compare and the tokens. Everything about how oasdiff judges the API (the severity that fails the job, ignore files, severity levels, deprecation windows) goes in `.oasdiff.yaml`, where every oasdiff flag works and the same file gives you the same answer when you run oasdiff locally. The `breaking`, `changelog` and `diff` actions automatically pick up a `.oasdiff.yaml` file from the root of your checked-out repository. This lets you keep CLI-flag-shaped configuration in source control instead of repeating the same `with:` block in every workflow file. @@ -196,10 +196,6 @@ Drop a `.oasdiff.yaml` next to your spec: ```yaml # .oasdiff.yaml fail-on: ERR -exclude-elements: - - description - - title - - summary err-ignore: ./oasdiff-err-ignore.txt severity-levels: ./oasdiff-levels.txt ``` @@ -212,6 +208,8 @@ response-non-success-status-removed err api-tag-removed none ``` +`exclude-elements` and `exclude-extensions` apply to the `diff` action only. The `breaking`, `changelog` and `pr-comment` actions compare the specs in full, so that excluding part of a spec cannot remove a change from the report. To turn a check off there, set its level to `none`. + The actions read this file from the runner's `$GITHUB_WORKSPACE` (which `actions/checkout` populates), so no extra steps are needed. **Precedence**: action `with:` inputs override `.oasdiff.yaml` values, which override built-in defaults. Setting `fail-on: ERR` in YAML and leaving the action's `fail-on:` input empty applies the YAML value; setting both lets the action input win. diff --git a/breaking/action.yml b/breaking/action.yml index 83256dd..e9a93ae 100644 --- a/breaking/action.yml +++ b/breaking/action.yml @@ -25,7 +25,7 @@ inputs: description: 'Consider minimum sunset period for deprecation of stable API endpoints' required: false exclude-elements: - description: 'Exclude certain kinds of changes' + description: 'Ignored: the checks compare the specs in full. To turn a check off, set its level to none in a severity levels file' required: false default: '' filter-extension: diff --git a/breaking/entrypoint.sh b/breaking/entrypoint.sh index bf3809e..7c7ae52 100755 --- a/breaking/entrypoint.sh +++ b/breaking/entrypoint.sh @@ -478,7 +478,7 @@ run_breaking () { flags="$flags --deprecation-days-stable $deprecation_days_stable" fi if [ -n "$exclude_elements" ]; then - flags="$flags --exclude-elements $exclude_elements" + echo "::warning::oasdiff: 'exclude-elements' is ignored, breaking and changelog compare the specs in full. To turn a check off, add 'severity-levels: ' to .oasdiff.yaml, listing the check id with level 'none'." fi if [ -n "$filter_extension" ]; then flags="$flags --filter-extension $filter_extension" @@ -659,7 +659,7 @@ run_changelog () { flags="$flags --include-path-params" fi if [ -n "$exclude_elements" ]; then - flags="$flags --exclude-elements $exclude_elements" + echo "::warning::oasdiff: 'exclude-elements' is ignored, breaking and changelog compare the specs in full. To turn a check off, add 'severity-levels: ' to .oasdiff.yaml, listing the check id with level 'none'." fi if [ -n "$filter_extension" ]; then flags="$flags --filter-extension $filter_extension" diff --git a/changelog/action.yml b/changelog/action.yml index f15ddb4..c842cb1 100644 --- a/changelog/action.yml +++ b/changelog/action.yml @@ -12,7 +12,7 @@ inputs: required: false default: 'false' exclude-elements: - description: 'Exclude certain kinds of changes' + description: 'Ignored: the checks compare the specs in full. To turn a check off, set its level to none in a severity levels file' required: false default: '' filter-extension: diff --git a/pr-comment/action.yml b/pr-comment/action.yml index 6833384..949e585 100644 --- a/pr-comment/action.yml +++ b/pr-comment/action.yml @@ -12,7 +12,7 @@ inputs: required: false default: 'false' exclude-elements: - description: 'Exclude certain kinds of changes' + description: 'Ignored: the checks compare the specs in full. To turn a check off, set its level to none in a severity levels file' required: false default: '' composed: diff --git a/pr-comment/entrypoint.sh b/pr-comment/entrypoint.sh index 1c744d3..4dba94d 100755 --- a/pr-comment/entrypoint.sh +++ b/pr-comment/entrypoint.sh @@ -29,7 +29,7 @@ if [ "$include_path_params" = "true" ]; then flags="$flags --include-path-params" fi if [ -n "$exclude_elements" ]; then - flags="$flags --exclude-elements $exclude_elements" + echo "::warning::oasdiff: 'exclude-elements' is ignored, breaking and changelog compare the specs in full. To turn a check off, add 'severity-levels: ' to .oasdiff.yaml, listing the check id with level 'none'." fi if [ "$composed" = "true" ]; then flags="$flags -c"