Skip to content

Commit b6a4ed5

Browse files
feat: add err-ignore and warn-ignore to breaking action (#82)
* feat: add err-ignore and warn-ignore support to breaking action Expose --err-ignore and --warn-ignore CLI flags as action inputs so users can suppress specific false-positive breaking changes by pattern. Closes #66 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: correct err-ignore pattern format MatchIgnore requires the line to contain both 'METHOD /path' and the localized change text. Update to: 'GET /pets api removed without deprecation' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d518b52 commit b6a4ed5

File tree

5 files changed

+47
-2
lines changed

5 files changed

+47
-2
lines changed

.github/workflows/test.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,27 @@ jobs:
302302
echo "Expected output '$OASDIFF_ACTION_TEST_EXPECTED_OUTPUT' but got '$output'" >&2
303303
exit 1
304304
fi
305+
oasdiff_breaking_err_ignore:
306+
runs-on: ubuntu-latest
307+
name: Test breaking action with err-ignore option
308+
steps:
309+
- name: checkout
310+
uses: actions/checkout@v4
311+
- name: Running breaking action with err-ignore option
312+
id: test_breaking_err_ignore
313+
uses: ./breaking
314+
with:
315+
base: 'specs/base.yaml'
316+
revision: 'specs/revision-breaking.yaml'
317+
err-ignore: 'specs/err-ignore.txt'
318+
- name: Test breaking changes are suppressed
319+
run: |
320+
delimiter=$(cat /proc/sys/kernel/random/uuid | tr -d '-')
321+
output=$(cat <<-$delimiter
322+
${{ steps.test_breaking_err_ignore.outputs.breaking }}
323+
$delimiter
324+
)
325+
if [ "$output" != "No breaking changes" ]; then
326+
echo "Expected 'No breaking changes' but got '$output'" >&2
327+
exit 1
328+
fi

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ jobs:
3434
| `filter-extension` | `''` | Exclude paths and operations with an OpenAPI Extension matching this expression | regex |
3535
| `composed` | `false` | Run in composed mode | `true`, `false` |
3636
| `flatten-allof` | `false` | Merge allOf subschemas into a single schema before diff | `true`, `false` |
37+
| `err-ignore` | `''` | Path to a file containing regex patterns for error-level changes to ignore | file path |
38+
| `warn-ignore` | `''` | Path to a file containing regex patterns for warning-level changes to ignore | file path |
3739
| `output-to-file` | `''` | Write output to this file path instead of stdout | file path |
3840

3941
### Generate a changelog

breaking/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ inputs:
4040
description: 'Merge allOf subschemas into a single schema before diff'
4141
required: false
4242
default: 'false'
43+
err-ignore:
44+
description: 'Path to a file containing regex patterns for error-level changes to ignore'
45+
required: false
46+
default: ''
47+
warn-ignore:
48+
description: 'Path to a file containing regex patterns for warning-level changes to ignore'
49+
required: false
50+
default: ''
4351
output-to-file:
4452
description: 'Output to a file at the given path'
4553
required: false
@@ -62,4 +70,6 @@ runs:
6270
- ${{ inputs.filter-extension }}
6371
- ${{ inputs.composed }}
6472
- ${{ inputs.flatten-allof }}
73+
- ${{ inputs.err-ignore }}
74+
- ${{ inputs.warn-ignore }}
6575
- ${{ inputs.output-to-file }}

breaking/entrypoint.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ readonly exclude_elements="$8"
1717
readonly filter_extension="$9"
1818
readonly composed="${10}"
1919
readonly flatten_allof="${11}"
20-
readonly output_to_file="${12}"
20+
readonly err_ignore="${12}"
21+
readonly warn_ignore="${13}"
22+
readonly output_to_file="${14}"
2123

2224
write_output () {
2325
_write_output_output="$1"
@@ -39,7 +41,7 @@ write_output () {
3941
echo "$_write_output_output" >>"$GITHUB_OUTPUT"
4042
}
4143

42-
echo "running oasdiff breaking... base: $base, revision: $revision, fail_on: $fail_on, include_checks: $include_checks, include_path_params: $include_path_params, deprecation_days_beta: $deprecation_days_beta, deprecation_days_stable: $deprecation_days_stable, exclude_elements: $exclude_elements, filter_extension: $filter_extension, composed: $composed, flatten_allof: $flatten_allof, output_to_file: $output_to_file"
44+
echo "running oasdiff breaking... base: $base, revision: $revision, fail_on: $fail_on, include_checks: $include_checks, include_path_params: $include_path_params, deprecation_days_beta: $deprecation_days_beta, deprecation_days_stable: $deprecation_days_stable, exclude_elements: $exclude_elements, filter_extension: $filter_extension, composed: $composed, flatten_allof: $flatten_allof, err_ignore: $err_ignore, warn_ignore: $warn_ignore, output_to_file: $output_to_file"
4345

4446
# Build flags to pass in command
4547
flags=""
@@ -67,6 +69,12 @@ fi
6769
if [ "$flatten_allof" = "true" ]; then
6870
flags="$flags --flatten-allof"
6971
fi
72+
if [ -n "$err_ignore" ]; then
73+
flags="$flags --err-ignore $err_ignore"
74+
fi
75+
if [ -n "$warn_ignore" ]; then
76+
flags="$flags --warn-ignore $warn_ignore"
77+
fi
7078
echo "flags: $flags"
7179

7280
# Check for breaking changes

specs/err-ignore.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GET /pets api removed without deprecation

0 commit comments

Comments
 (0)