openapi-diff.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. name: openapi-diff
  2. on:
  3. pull_request:
  4. jobs:
  5. check-diff:
  6. name: build api
  7. runs-on: ubuntu-20.04
  8. timeout-minutes: 90
  9. steps:
  10. - uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2
  11. with:
  12. # Avoid codecov error message related to SHA resolution:
  13. # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
  14. fetch-depth: '2'
  15. - name: Check for python file changes
  16. uses: getsentry/paths-filter@66f7f1844185eb7fb6738ea4ea59d74bb99199e5 # v2
  17. id: changes
  18. with:
  19. token: ${{ github.token }}
  20. filters: .github/file-filters.yml
  21. - name: Setup sentry env
  22. uses: ./.github/actions/setup-sentry
  23. if: steps.changes.outputs.api_docs == 'true'
  24. id: setup
  25. - name: Checkout getsentry/sentry-api-schema
  26. uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2
  27. if: steps.changes.outputs.api_docs == 'true'
  28. with:
  29. ref: 'main'
  30. repository: getsentry/sentry-api-schema
  31. path: sentry-api-schema
  32. - uses: ./.github/actions/setup-volta
  33. if: steps.changes.outputs.api_docs == 'true'
  34. - name: Build OpenAPI Derefed JSON
  35. if: steps.changes.outputs.api_docs == 'true'
  36. # install ts-node for ts build scripts to execute properly without potentially installing
  37. # conflicting deps when running scripts locally
  38. # see: https://github.com/getsentry/sentry/pull/32328/files
  39. run: |
  40. yarn add ts-node && make build-api-docs
  41. - name: Compare OpenAPI Derefed JSON
  42. if: steps.changes.outputs.api_docs == 'true'
  43. run: |
  44. npx json-diff@0.5.4 --color sentry-api-schema/openapi-derefed.json tests/apidocs/openapi-derefed.json