fix: fix the OpenAPI change detection in release job#1079
Open
ShradhaGupta31 wants to merge 1 commit into
Open
fix: fix the OpenAPI change detection in release job#1079ShradhaGupta31 wants to merge 1 commit into
ShradhaGupta31 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1079 +/- ##
=======================================
Coverage 43.39% 43.39%
=======================================
Files 141 141
Lines 13397 13397
=======================================
Hits 5814 5814
Misses 7022 7022
Partials 561 561 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sudhir-intc
approved these changes
Jun 16, 2026
There was a problem hiding this comment.
Pull request overview
This PR fixes OpenAPI change detection in the release GitHub Actions workflow so the SwaggerHub publish steps run when OpenAPI-related source files actually changed in the triggering push/merge.
Changes:
- Adjusts
actions/checkoutto fetch an additional commit (fetch-depth: 2) so a parent commit is available. - Updates the OpenAPI change detection from
git diff origin/main HEADtogit diff HEAD~1 HEADand removes thegit fetch origin maindependency.
Comments suppressed due to low confidence (1)
.github/workflows/release.yml:244
git diff --name-only HEAD~1 HEADonly inspects the last commit. Since this workflow runs onpushtomain/beta, a push that contains multiple commits (or a merge + follow-up fix commit) could include OpenAPI changes that aren’t inHEADitself, causing a falsechanged=false. Using the push range${{ github.event.before }}→${{ github.sha }}makes the check cover the entire push and avoids depending onHEAD~1being the correct base.
if git diff --name-only HEAD~1 HEAD | grep -q '^internal/controller/openapi/'; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
4754f1b to
ec3723a
Compare
- Use github.event.before..github.sha instead of origin/main..HEAD to detect OpenAPI changes across the full push range. Signed-off-by: ShradhaGupta31 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses: #1080
Issue Root cause: The "Check if OpenAPI files changed" step ran after Semantic Release, which had already pushed a new release commit to origin/main. At that point git diff origin/main HEAD compared in the wrong direction showing the changelog/version bump files, not the OpenAPI changes from the merged PR so the grep never matched and changed=false detected and hence further steps were skipped.
Fix: