Update documentation #18
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 PR Documentation | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| validate-openapi: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout PR Code | |
| uses: actions/checkout@v4 | |
| with: | |
| # This is critical for pull_request_target. It ensures we checkout | |
| # the code from the PR, not the base branch. | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| # fetch-depth: 0 is not strictly needed for validation, but kept it | |
| # in case your validation scripts need the full git history. | |
| fetch-depth: 0 | |
| - name: Start Swagger Validator | |
| run: | | |
| # Pull the Swagger validator image | |
| docker pull swaggerapi/swagger-validator-v2 | |
| # Start the validator container | |
| docker run --detach --name swagger-validator --publish 8080:8080 swaggerapi/swagger-validator-v2 | |
| # Wait for the validator to be ready | |
| timeout 30 bash -c 'until curl -s http://localhost:8080/ >/dev/null 2>&1; do sleep 1; done' | |
| - name: Validate OpenAPI JSON | |
| run: | | |
| echo "Validating openapi.json..." | |
| response=$(curl --silent --request POST http://localhost:8080/validator/debug \ | |
| --header "Content-Type: application/json" \ | |
| --data-binary @openapi.json) | |
| echo "Validation response: $response" | |
| # Check if response contains validation errors | |
| if echo "$response" | grep -q '"messages"'; then | |
| echo "❌ OpenAPI validation failed with errors:" | |
| echo "$response" | python3 -m json.tool | |
| exit 1 | |
| else | |
| echo "✅ openapi.json validation passed" | |
| fi | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| docker stop swagger-validator || true | |
| docker rm swagger-validator || true |