getsentry-dispatch.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Dispatch a request to getsentry to run getsentry test suites
  2. name: getsentry dispatcher
  3. on:
  4. # XXX: We are using `pull_request_target` instead of `pull_request` because we want
  5. # this to run on forks. It allows forks to access secrets safely by
  6. # only running workflows from the main branch. Prefer to use `pull_request` when possible.
  7. #
  8. # See https://github.com/getsentry/sentry/pull/21600 for more details
  9. pull_request_target:
  10. types: [labeled, opened, reopened, synchronize]
  11. # disable all other special privileges
  12. permissions:
  13. # needed for `actions/checkout` to clone the code
  14. contents: read
  15. # needed to remove the pull-request label
  16. pull-requests: write
  17. jobs:
  18. dispatch:
  19. if: github.event.action != 'labeled' || github.event.label.name == 'trigger-getsentry-external'
  20. name: getsentry dispatch
  21. runs-on: ubuntu-20.04
  22. steps:
  23. - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3
  24. with:
  25. persist-credentials: false
  26. - name: permissions
  27. run: |
  28. python3 -uS .github/workflows/scripts/getsentry-dispatch-setup \
  29. --repo-id ${{ github.event.repository.id }} \
  30. --pr ${{ github.event.number }} \
  31. --event ${{ github.event.action }} \
  32. --username "$ARG_USERNAME" \
  33. --label-names "$ARG_LABEL_NAMES"
  34. env:
  35. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  36. # these can contain special characters
  37. ARG_USERNAME: ${{ github.event.pull_request.user.login }}
  38. ARG_LABEL_NAMES: ${{ toJSON(github.event.pull_request.labels.*.name) }}
  39. - name: Check for file changes
  40. uses: getsentry/paths-filter@66f7f1844185eb7fb6738ea4ea59d74bb99199e5 # v2
  41. id: changes
  42. with:
  43. token: ${{ github.token }}
  44. filters: .github/file-filters.yml
  45. - name: getsentry token
  46. uses: getsentry/action-github-app-token@38a3ce582e170ddfe8789f509597c6944f2292a9 # v1
  47. id: getsentry
  48. with:
  49. app_id: ${{ secrets.SENTRY_INTERNAL_APP_ID }}
  50. private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
  51. - name: Dispatch getsentry tests
  52. uses: actions/github-script@f05a81df23035049204b043b50c3322045ce7eb3 # v3
  53. with:
  54. github-token: ${{ steps.getsentry.outputs.token }}
  55. script: |
  56. require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/scripts/getsentry-dispatch`).dispatch({
  57. github,
  58. context,
  59. fileChanges: ${{ toJson(steps.changes.outputs) }}
  60. });