v7.1.0 Community Sync (26 commits) (#351) #301
Workflow file for this run
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
| name: Validate OpenAPI | |
| on: | |
| push: | |
| paths: | |
| - 'docs/api/**/*.yaml' | |
| - 'docs/api/**/*.yml' | |
| - '.github/workflows/validate-openapi.yml' | |
| - '.spectral.yaml' | |
| pull_request: | |
| paths: | |
| - 'docs/api/**/*.yaml' | |
| - 'docs/api/**/*.yml' | |
| - '.github/workflows/validate-openapi.yml' | |
| - '.spectral.yaml' | |
| jobs: | |
| validate: | |
| name: Validate OpenAPI Spec | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| - name: Install validation tools | |
| run: | | |
| npm install -g @apidevtools/swagger-cli | |
| npm install -g @stoplight/spectral-cli | |
| npm install -g @redocly/cli | |
| - name: Validate OpenAPI spec syntax | |
| run: | | |
| echo "Validating OpenAPI specification syntax..." | |
| swagger-cli validate docs/api/policy-api.yaml | |
| echo "✅ Syntax validation passed" | |
| - name: Lint OpenAPI spec | |
| run: | | |
| echo "Linting OpenAPI specification..." | |
| # Fail on errors, allow warnings | |
| spectral lint docs/api/policy-api.yaml --ruleset .spectral.yaml --fail-severity error | |
| echo "✅ Linting passed" | |
| - name: Get base spec for comparison | |
| if: github.event_name == 'pull_request' | |
| id: base-spec | |
| run: | | |
| git fetch origin ${{ github.base_ref }} --depth=1 | |
| # Save base spec in workspace (not /tmp) so Docker action can access it | |
| if git show origin/${{ github.base_ref }}:docs/api/policy-api.yaml > base-spec.yaml 2>/dev/null; then | |
| echo "has_base=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_base=false" >> $GITHUB_OUTPUT | |
| echo "ℹ️ No previous spec found on base branch - skipping breaking change check" | |
| fi | |
| - name: Check for breaking changes | |
| if: github.event_name == 'pull_request' && steps.base-spec.outputs.has_base == 'true' | |
| uses: oasdiff/oasdiff-action/breaking@main | |
| with: | |
| base: base-spec.yaml | |
| revision: docs/api/policy-api.yaml | |
| # For v2.0.0: Fail on ERR only (actual breaking changes) | |
| # Warnings for new enum values in responses are acceptable for major versions | |
| fail-on: ERR | |
| - name: Generate documentation preview | |
| run: | | |
| echo "Generating documentation preview..." | |
| npx @redocly/cli build-docs docs/api/policy-api.yaml -o /tmp/api-docs.html | |
| echo "✅ Documentation generated successfully" | |
| - name: Upload documentation preview | |
| if: github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: api-docs-preview | |
| path: /tmp/api-docs.html | |
| retention-days: 7 | |
| bundle: | |
| name: Bundle OpenAPI Spec | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| - name: Install tools | |
| run: npm install -g @redocly/cli | |
| - name: Bundle specification | |
| run: | | |
| npx @redocly/cli bundle docs/api/policy-api.yaml -o docs/api/policy-api-bundled.yaml | |
| echo "✅ Bundled specification created" | |
| - name: Generate static documentation | |
| run: | | |
| npx @redocly/cli build-docs docs/api/policy-api.yaml -o docs/api/index.html | |
| echo "✅ Static documentation generated" | |
| - name: Upload bundled artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: openapi-bundle | |
| path: | | |
| docs/api/policy-api-bundled.yaml | |
| docs/api/index.html | |
| retention-days: 30 |