Skip to content

Commit 14b7506

Browse files
ci: deploy bump.sh spec only when there are relevant spec changes (#792)
1 parent ddb1dd7 commit 14b7506

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/release-spec.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ jobs:
106106
needs: [run-required-validations]
107107
outputs:
108108
changes_detected: ${{ steps.commit.outputs.changes_detected }}
109+
bump_release: ${{ steps.bump_changes.outputs.bump_release }}
109110
steps:
110111
- name: Checkout repository
111112
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
@@ -156,6 +157,22 @@ jobs:
156157
env:
157158
target_env: ${{ inputs.env }}
158159
run: ../release-scripts/branded_preview.sh
160+
- name: Check if changes should be deployed to bump.sh
161+
id: bump_changes
162+
run: |
163+
# We often only update the x-xgen-sha property in OAS since we need
164+
# this piece of information during the changelog release. However, this small changes
165+
# should not trigger a bump.sh release since the rendered spec is still the same.
166+
# This logic makes sure that the v2.json file changes are more than 1 lines
167+
# which suggests that we are not only updating the x-xgen-sha property.
168+
169+
export bump_release='false'
170+
changed_lines=$(git diff --numstat openapi/v2.json | awk '{print $1}')
171+
if [ "${changed_lines}" -gt 1 ]; then
172+
export bump_release='true'
173+
fi
174+
175+
echo "bump_release=${bump_release}" >> "${GITHUB_OUTPUT:?}"
159176
- name: Commit changes
160177
id: commit
161178
uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0
@@ -197,7 +214,7 @@ jobs:
197214
release-bump-sh:
198215
name: Release API Specification to Bump.sh for ${{ inputs.branch }}
199216
needs: release
200-
if: ${{needs.release.outputs.changes_detected == 'true'}}
217+
if: ${{needs.release.outputs.bump_release == 'true'}}
201218
uses: ./.github/workflows/generate-bump-pages.yml
202219
secrets:
203220
api_bot_pat: ${{ secrets.api_bot_pat }}

0 commit comments

Comments
 (0)