From fd1bd89b4554c5f011f18d5166d3f04deb9faedc Mon Sep 17 00:00:00 2001 From: timonrieger Date: Tue, 24 Jun 2025 01:29:39 +0200 Subject: [PATCH 1/7] add support for prefix-base, prefix-revision, format and case-insensitive-headers to oasdiff changelog github action --- changelog/action.yml | 20 ++++++++++++++++++++ changelog/entrypoint.sh | 16 ++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/changelog/action.yml b/changelog/action.yml index 4fb32d3..aa23fdc 100644 --- a/changelog/action.yml +++ b/changelog/action.yml @@ -23,6 +23,22 @@ inputs: description: 'Output to a file at the given path' required: false default: '' + prefix-base: + description: 'Prefix for base version' + required: false + default: '' + prefix-revision: + description: 'Prefix for revision version' + required: false + default: '' + case-insensitive-headers: + description: 'Case insensitive headers' + required: false + default: 'false' + format: + description: 'Output format' + required: false + default: '' outputs: changelog: description: 'Output summary of API changelog' @@ -36,3 +52,7 @@ runs: - ${{ inputs.exclude-elements }} - ${{ inputs.composed }} - ${{ inputs.output-to-file }} + - ${{ inputs.prefix-base }} + - ${{ inputs.prefix-revision }} + - ${{ inputs.case-insensitive-headers }} + - ${{ inputs.format }} diff --git a/changelog/entrypoint.sh b/changelog/entrypoint.sh index 1b0767c..0d43b4a 100755 --- a/changelog/entrypoint.sh +++ b/changelog/entrypoint.sh @@ -26,6 +26,10 @@ readonly include_path_params="$3" readonly exclude_elements="$4" readonly composed="$5" readonly output_to_file="$6" +readonly prefix_base="$7" +readonly prefix_revision="$8" +readonly case_insensitive_headers="$9" +readonly format="$10" echo "running oasdiff changelog base: $base, revision: $revision, include_path_params: $include_path_params, exclude_elements: $exclude_elements, composed: $composed, output_to_file: $output_to_file" @@ -40,6 +44,18 @@ fi if [ "$composed" = "true" ]; then flags="$flags -c" fi +if [ -n "$prefix_base" ]; then + flags="$flags --prefix-base $prefix_base" +fi +if [ -n "$prefix_revision" ]; then + flags="$flags --prefix-revision $prefix_revision" +fi +if [ "$case_insensitive_headers" = "true" ]; then + flags="$flags --case-insensitive-headers" +fi +if [ -n "$format" ]; then + flags="$flags --format $format" +fi echo "flags: $flags" set -o pipefail From c83baa12d2a4dcdeb70beff6a7a3082090d9a707 Mon Sep 17 00:00:00 2001 From: timonrieger Date: Mon, 25 Aug 2025 18:47:21 +0300 Subject: [PATCH 2/7] fix: correct shell argument parsing for format parameter in oasdiff action --- changelog/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/entrypoint.sh b/changelog/entrypoint.sh index 0d43b4a..4c60caf 100755 --- a/changelog/entrypoint.sh +++ b/changelog/entrypoint.sh @@ -29,7 +29,7 @@ readonly output_to_file="$6" readonly prefix_base="$7" readonly prefix_revision="$8" readonly case_insensitive_headers="$9" -readonly format="$10" +readonly format="${10}" echo "running oasdiff changelog base: $base, revision: $revision, include_path_params: $include_path_params, exclude_elements: $exclude_elements, composed: $composed, output_to_file: $output_to_file" From 4d867cd0a512f58a6f1710e989f788d2081f6e17 Mon Sep 17 00:00:00 2001 From: timonrieger Date: Mon, 25 Aug 2025 18:52:33 +0300 Subject: [PATCH 3/7] fix: create output directory before writing files in oasdiff action --- changelog/entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog/entrypoint.sh b/changelog/entrypoint.sh index 4c60caf..d0bb19d 100755 --- a/changelog/entrypoint.sh +++ b/changelog/entrypoint.sh @@ -8,6 +8,8 @@ write_output () { if [ -z "$file_output" ]; then file_output=$output fi + # Create directory if it doesn't exist + mkdir -p "$(dirname "$output_to_file")" echo "$file_output" >> "$output_to_file" fi # github-action limits output to 1MB From b9fd68da046a0a58ae701e5b74077a1468610485 Mon Sep 17 00:00:00 2001 From: timonrieger Date: Tue, 26 Aug 2025 12:37:28 +0300 Subject: [PATCH 4/7] fix: set proper permissions for output file in oasdiff action --- changelog/entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog/entrypoint.sh b/changelog/entrypoint.sh index d0bb19d..51e0105 100755 --- a/changelog/entrypoint.sh +++ b/changelog/entrypoint.sh @@ -19,6 +19,8 @@ write_output () { echo "WARN: diff exceeds the 1MB limit, truncating output..." >&2 output=$(echo "$output" | head -c 1000000) fi + # Ensure proper permissions for the output file + chmod 644 "$output_to_file" echo "$output" >>"$GITHUB_OUTPUT" } From df8fcad625e5b7ccb51d855395daf75b64aaf135 Mon Sep 17 00:00:00 2001 From: timonrieger Date: Tue, 26 Aug 2025 12:44:01 +0300 Subject: [PATCH 5/7] refactor: remove redundant directory creation and permission setting in oasdiff action --- changelog/entrypoint.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/changelog/entrypoint.sh b/changelog/entrypoint.sh index 51e0105..4c60caf 100755 --- a/changelog/entrypoint.sh +++ b/changelog/entrypoint.sh @@ -8,8 +8,6 @@ write_output () { if [ -z "$file_output" ]; then file_output=$output fi - # Create directory if it doesn't exist - mkdir -p "$(dirname "$output_to_file")" echo "$file_output" >> "$output_to_file" fi # github-action limits output to 1MB @@ -19,8 +17,6 @@ write_output () { echo "WARN: diff exceeds the 1MB limit, truncating output..." >&2 output=$(echo "$output" | head -c 1000000) fi - # Ensure proper permissions for the output file - chmod 644 "$output_to_file" echo "$output" >>"$GITHUB_OUTPUT" } From d9722e1d94cbaa507df1b18fb94ee015528febca Mon Sep 17 00:00:00 2001 From: timonrieger Date: Wed, 8 Oct 2025 13:42:14 +0200 Subject: [PATCH 6/7] docs: update README to include new CLI arguments for oasdiff changelog action --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5fbb8d8..568de05 100644 --- a/README.md +++ b/README.md @@ -64,9 +64,13 @@ Copy and paste the following snippet into your build .yml file: Additional arguments: -| CLI | Action input | Default | -| --------------------- | ------------------- | ------- | -| --include-path-params | include-path-params | false | -| --exclude-elements | exclude-elements | '' | -| --composed | composed | false | -| N/A | output-to-file | '' | +| CLI | Action input | Default | +| ----------------------| ----------------------- | ------- | +| --include-path-params | include-path-params | false | +| --exclude-elements | exclude-elements | '' | +| --composed | composed | false | +| --prefix-base | prefix-base | '' | +| --prefix-revision | prefix-revision | '' | +| --case-insensitive-headers| case-insensitive-headers| false | +| --format | format | '' | +| N/A | output-to-file | '' | From ab9c86d017057ff8101eee2981544e9a1c923ab3 Mon Sep 17 00:00:00 2001 From: timonrieger Date: Wed, 8 Oct 2025 13:43:00 +0200 Subject: [PATCH 7/7] docs: include additional changelog action parameters in debug output --- changelog/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/entrypoint.sh b/changelog/entrypoint.sh index 4c60caf..9124dd2 100755 --- a/changelog/entrypoint.sh +++ b/changelog/entrypoint.sh @@ -31,7 +31,7 @@ readonly prefix_revision="$8" readonly case_insensitive_headers="$9" readonly format="${10}" -echo "running oasdiff changelog base: $base, revision: $revision, include_path_params: $include_path_params, exclude_elements: $exclude_elements, composed: $composed, output_to_file: $output_to_file" +echo "running oasdiff changelog base: $base, revision: $revision, include_path_params: $include_path_params, exclude_elements: $exclude_elements, composed: $composed, output_to_file: $output_to_file, prefix_base: $prefix_base, prefix_revision: $prefix_revision, case_insensitive_headers: $case_insensitive_headers, format: $format" # Build flags to pass in command flags=""