-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
2,941 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Validate Swagger Generation | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check-swagger: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Checkout the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Step 2: Generate the swagger.json (customize this as per your repo setup) | ||
- name: Generate Swagger file | ||
run: | | ||
make generate-swagger | ||
echo "Swagger generated!" | ||
# Step 3: Compare the newly generated swagger.json with the committed swagger.json | ||
- name: Check for Swagger differences | ||
run: | | ||
git diff --exit-code pkg/swagger/swagger.json | ||
continue-on-error: true | ||
|
||
# Step 4: Fail the build if Swagger doesn't match | ||
- name: Fail if Swagger has differences | ||
if: failure() # This will cause the workflow to fail if there was a diff in the previous step | ||
run: | | ||
echo "Swagger is outdated. Please regenerate it with 'make generate-swagger' and commit the changes." | ||
exit 1 |
Oops, something went wrong.