openapi-diff.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. strategy:
  10. matrix:
  11. python-version: [3.8.12]
  12. steps:
  13. - uses: actions/checkout@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@v2
  20. id: changes
  21. with:
  22. token: ${{ github.token }}
  23. filters: .github/file-filters.yml
  24. - name: Setup sentry env (python ${{ matrix.python-version }})
  25. uses: ./.github/actions/setup-sentry
  26. if: steps.changes.outputs.api_docs == 'true'
  27. id: setup
  28. with:
  29. python-version: ${{ matrix.python-version }}
  30. - name: Checkout getsentry/sentry-api-schema
  31. uses: actions/checkout@v2
  32. if: steps.changes.outputs.api_docs == 'true'
  33. with:
  34. ref: 'main'
  35. repository: getsentry/sentry-api-schema
  36. path: sentry-api-schema
  37. - uses: ./.github/actions/setup-volta
  38. if: steps.changes.outputs.api_docs == 'true'
  39. - name: Build OpenAPI Derefed JSON
  40. if: steps.changes.outputs.api_docs == 'true'
  41. # install ts-node for ts build scripts to execute properly without potentially installing
  42. # conflicting deps when running scripts locally
  43. # see: https://github.com/getsentry/sentry/pull/32328/files
  44. run: |
  45. yarn add ts-node && make build-api-docs
  46. - name: Compare OpenAPI Derefed JSON
  47. if: steps.changes.outputs.api_docs == 'true'
  48. run: |
  49. npx json-diff@0.5.4 --color sentry-api-schema/openapi-derefed.json tests/apidocs/openapi-derefed.json