Actions: Add Swagger verification (#106873)
This commit is contained in:
@@ -842,6 +842,7 @@ embed.go @grafana/grafana-as-code
|
||||
/.github/workflows/shellcheck.yml @grafana/grafana-developer-enablement-squad
|
||||
/.github/workflows/release-build.yml @grafana/grafana-developer-enablement-squad
|
||||
/.github/actions/changelog @zserge
|
||||
/.github/workflows/swagger-gen.yml @grafana/grafana-backend-group
|
||||
/.github/workflows/pr-frontend-unit-tests.yml @grafana/grafana-frontend-platform
|
||||
/.github/workflows/frontend-lint.yml @grafana/grafana-frontend-platform
|
||||
/.github/workflows/analytics-events-report.yml @grafana/grafana-frontend-platform
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
name: Swagger generated code
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release-*
|
||||
pull_request:
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
name: Verify committed API specs match
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) || github.repository == 'grafana/grafana' }}
|
||||
permissions:
|
||||
contents: read # clone the repository
|
||||
id-token: write # required for Vault access
|
||||
steps:
|
||||
# Set up repository clone
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: Setup Enterprise
|
||||
uses: ./.github/actions/setup-enterprise
|
||||
with:
|
||||
github-app-name: 'grafana-ci-bot'
|
||||
|
||||
- name: Set go version
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Generate Swagger specs
|
||||
run: make swagger-clean && make openapi3-gen
|
||||
- name: Check for changes
|
||||
run: |
|
||||
git add -f public/api-merged.json public/openapi3.json
|
||||
if [ -z "$(git diff --name-only --cached)" ]; then
|
||||
echo "No changes detected in API specs."
|
||||
else
|
||||
echo "Changes detected in API specs. Please review the changes."
|
||||
echo "You can regenerate them locally with: make swagger-clean && make openapi3-gen"
|
||||
exit 1
|
||||
fi
|
||||
@@ -22,6 +22,7 @@ rules:
|
||||
- pr-test-integration.yml
|
||||
- publish-kinds-release.yml
|
||||
- pr-e2e-tests.yml
|
||||
- swagger-gen.yml
|
||||
dangerous-triggers:
|
||||
ignore:
|
||||
- auto-milestone.yml
|
||||
|
||||
Reference in New Issue
Block a user