From 390232a94c28c39020fdab00bc80f0908edbb0be Mon Sep 17 00:00:00 2001 From: Andrea Angiolillo Date: Mon, 30 Jun 2025 18:25:38 +0100 Subject: [PATCH 1/2] ci: deploy bump.sh spec only when there are relevant spec changes --- .github/workflows/release-spec.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-spec.yml b/.github/workflows/release-spec.yml index 9028ced953..2f6d15db30 100644 --- a/.github/workflows/release-spec.yml +++ b/.github/workflows/release-spec.yml @@ -106,6 +106,7 @@ jobs: needs: [run-required-validations] outputs: changes_detected: ${{ steps.commit.outputs.changes_detected }} + bump_release: ${{ steps.bump_changes.outputs.bump_release }} steps: - name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 @@ -156,6 +157,22 @@ jobs: env: target_env: ${{ inputs.env }} run: ../release-scripts/branded_preview.sh + - name: Check if changes should be deployed to bump.sh + id: bump_changes + run: | + # We often only update the x-xgen-sha property in OAS since we need + # this piece of information during the changelog release. However, this small changes + # should not trigger a bump.sh release since the rendered spec is still the same. + # This logic makes sure that the v2.json file changes are more than 1 lines + # which suggests that we are not only updating the x-xgen-sha property. + + export bump_release='false' + changed_lines=$(git diff --numstat openapi/v2.json | awk '{print $1}') + if [ "${changed_lines}" -gt 1 ]; then + export bump_release='true' + fi + + echo "bump_release=${bump_release}" >> "${GITHUB_OUTPUT:?}" - name: Commit changes id: commit uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 @@ -197,7 +214,7 @@ jobs: release-bump-sh: name: Release API Specification to Bump.sh for ${{ inputs.branch }} needs: release - if: ${{needs.release.outputs.changes_detected == 'true'}} + if: ${{needs.release.outputs.bump_release == 'true'}} uses: ./.github/workflows/generate-bump-pages.yml secrets: api_bot_pat: ${{ secrets.api_bot_pat }} From 7e9f318ee24854ba6b7df42a5f40bf6a47ddc58a Mon Sep 17 00:00:00 2001 From: Andrea Angiolillo Date: Tue, 1 Jul 2025 10:21:51 +0100 Subject: [PATCH 2/2] fix: handle scenario when there are no changes in v2.json --- .github/workflows/release-spec.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release-spec.yml b/.github/workflows/release-spec.yml index 2f6d15db30..dc64297df2 100644 --- a/.github/workflows/release-spec.yml +++ b/.github/workflows/release-spec.yml @@ -168,6 +168,8 @@ jobs: export bump_release='false' changed_lines=$(git diff --numstat openapi/v2.json | awk '{print $1}') + # Default to 0 if empty + changed_lines=${changed_lines:-0} if [ "${changed_lines}" -gt 1 ]; then export bump_release='true' fi