openapi-diff.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: openapi-diff
  2. on:
  3. pull_request:
  4. jobs:
  5. check-diff:
  6. name: build api
  7. runs-on: ubuntu-18.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. pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
  31. - name: Checkout getsentry/sentry-api-schema
  32. uses: actions/checkout@v2
  33. if: steps.changes.outputs.api_docs == 'true'
  34. with:
  35. ref: 'main'
  36. repository: getsentry/sentry-api-schema
  37. path: sentry-api-schema
  38. - name: Install/setup node
  39. if: steps.changes.outputs.api_docs == 'true'
  40. uses: volta-cli/action@v1
  41. - name: Build OpenAPI Derefed JSON
  42. if: steps.changes.outputs.api_docs == 'true'
  43. # install ts-node for ts build scripts to execute properly without potentially installing
  44. # conflicting deps when running scripts locally
  45. # see: https://github.com/getsentry/sentry/pull/32328/files
  46. run: |
  47. yarn add ts-node && make build-api-docs
  48. - name: Compare OpenAPI Derefed JSON
  49. if: steps.changes.outputs.api_docs == 'true'
  50. run: |
  51. npx json-diff@0.5.4 --color sentry-api-schema/openapi-derefed.json tests/apidocs/openapi-derefed.json