openapi.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. name: openapi
  2. on:
  3. push:
  4. branches:
  5. - master
  6. # hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
  7. env:
  8. SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
  9. jobs:
  10. build_and_deref_json:
  11. runs-on: ubuntu-22.04
  12. timeout-minutes: 90
  13. steps:
  14. - name: Getsentry Token
  15. id: getsentry
  16. uses: getsentry/action-github-app-token@d4b5da6c5e37703f8c3b3e43abb5705b46e159cc # v3.0.0
  17. with:
  18. app_id: ${{ vars.SENTRY_INTERNAL_APP_ID }}
  19. private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
  20. - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
  21. with:
  22. # Avoid codecov error message related to SHA resolution:
  23. # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891
  24. fetch-depth: '2'
  25. - name: Check for python file changes
  26. uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
  27. id: changes
  28. with:
  29. token: ${{ github.token }}
  30. filters: .github/file-filters.yml
  31. - name: Setup sentry env
  32. uses: ./.github/actions/setup-sentry
  33. if: steps.changes.outputs.api_docs == 'true'
  34. - name: Checkout getsentry/sentry-api-schema
  35. if: steps.changes.outputs.api_docs == 'true'
  36. uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
  37. with:
  38. ref: 'main'
  39. repository: getsentry/sentry-api-schema
  40. path: sentry-api-schema
  41. token: ${{ steps.getsentry.outputs.token }}
  42. - uses: getsentry/action-setup-volta@c52be2ea13cfdc084edb806e81958c13e445941e # v1.2.0
  43. if: steps.changes.outputs.api_docs == 'true'
  44. - name: Build OpenAPI Derefed JSON
  45. if: steps.changes.outputs.api_docs == 'true'
  46. # install ts-node for ts build scripts to execute properly without potentially installing
  47. # conflicting deps when running scripts locally
  48. # see: https://github.com/getsentry/sentry/pull/32328/files
  49. run: |
  50. yarn add ts-node && make build-api-docs
  51. - name: Copy artifact into getsentry/sentry-api-schema
  52. if: steps.changes.outputs.api_docs == 'true'
  53. run: |
  54. cp tests/apidocs/openapi-derefed.json sentry-api-schema
  55. - name: Copy publish status into getsentry/sentry-api-schema
  56. if: steps.changes.outputs.api_docs == 'true'
  57. run: |
  58. cp src/sentry/apidocs/api_ownership_stats_dont_modify.json sentry-api-schema
  59. - name: Git Commit & Push
  60. uses: stefanzweifel/git-auto-commit-action@0049e3fa4059ca715255fbbcb7dea4516f02ce0a # v4.15.3
  61. if: steps.changes.outputs.api_docs == 'true'
  62. with:
  63. repository: sentry-api-schema
  64. branch: main
  65. commit_message: Generated
  66. commit_user_email: bot@getsentry.com
  67. commit_user_name: openapi-getsentry-bot