openapi-diff.yml 1.9 KB

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