openapi.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. name: openapi
  2. on:
  3. push:
  4. branches:
  5. - master
  6. jobs:
  7. build_and_deref_json:
  8. runs-on: ubuntu-20.04
  9. timeout-minutes: 90
  10. strategy:
  11. matrix:
  12. python-version: [3.8.12]
  13. steps:
  14. - name: Getsentry Token
  15. id: getsentry
  16. uses: getsentry/action-github-app-token@v1
  17. with:
  18. app_id: ${{ secrets.SENTRY_INTERNAL_APP_ID }}
  19. private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
  20. - uses: actions/checkout@v2
  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: getsentry/paths-filter@v2
  27. id: changes
  28. with:
  29. token: ${{ github.token }}
  30. filters: .github/file-filters.yml
  31. - name: Setup sentry env (python ${{ matrix.python-version }})
  32. uses: ./.github/actions/setup-sentry
  33. if: steps.changes.outputs.api_docs == 'true'
  34. id: setup
  35. with:
  36. python-version: ${{ matrix.python-version }}
  37. - name: Checkout getsentry/sentry-api-schema
  38. if: steps.changes.outputs.api_docs == 'true'
  39. uses: actions/checkout@v2
  40. with:
  41. ref: 'main'
  42. repository: getsentry/sentry-api-schema
  43. path: sentry-api-schema
  44. token: ${{ steps.getsentry.outputs.token }}
  45. - uses: ./.github/actions/setup-volta
  46. if: steps.changes.outputs.api_docs == 'true'
  47. - name: Build OpenAPI Derefed JSON
  48. if: steps.changes.outputs.api_docs == 'true'
  49. # install ts-node for ts build scripts to execute properly without potentially installing
  50. # conflicting deps when running scripts locally
  51. # see: https://github.com/getsentry/sentry/pull/32328/files
  52. run: |
  53. yarn add ts-node && make build-api-docs
  54. - name: Copy artifact into getsentry/sentry-api-schema
  55. if: steps.changes.outputs.api_docs == 'true'
  56. run: |
  57. cp tests/apidocs/openapi-derefed.json sentry-api-schema
  58. - name: Git Commit & Push
  59. uses: stefanzweifel/git-auto-commit-action@5804e42f86b1891093b151b6c4e78e759c746c4d
  60. if: steps.changes.outputs.api_docs == 'true'
  61. with:
  62. repository: sentry-api-schema
  63. branch: main
  64. commit_message: Generated
  65. commit_user_email: bot@getsentry.com
  66. commit_user_name: openapi-getsentry-bot