openapi-diff.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. name: openapi-diff
  2. on:
  3. pull_request:
  4. # Cancel in progress workflows on pull_requests.
  5. # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
  6. concurrency:
  7. group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  8. cancel-in-progress: true
  9. # hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
  10. env:
  11. SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
  12. jobs:
  13. check-diff:
  14. name: build api
  15. runs-on: ubuntu-22.04
  16. timeout-minutes: 90
  17. steps:
  18. - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
  19. with:
  20. # Avoid codecov error message related to SHA resolution:
  21. # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
  22. fetch-depth: '2'
  23. - name: Check for python file changes
  24. uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
  25. id: changes
  26. with:
  27. token: ${{ github.token }}
  28. filters: .github/file-filters.yml
  29. - name: Setup sentry env
  30. uses: ./.github/actions/setup-sentry
  31. if: steps.changes.outputs.api_docs == 'true'
  32. - name: Checkout getsentry/sentry-api-schema
  33. uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
  34. if: steps.changes.outputs.api_docs == 'true'
  35. with:
  36. ref: 'main'
  37. repository: getsentry/sentry-api-schema
  38. path: sentry-api-schema
  39. - uses: getsentry/action-setup-volta@e4939d337b83760d13a9d7030a6f68c9d0ee7581 # v2.0.0
  40. if: steps.changes.outputs.api_docs == 'true'
  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