Skip to content

docs-updated

docs-updated #9

Workflow file for this run

name: Validate PR Documentation
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'openapi.json'
repository_dispatch:
types: [docs-updated]
jobs:
validate-openapi:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout PR
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout docs-updated branch
if: github.event_name == 'repository_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.branch }}
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