getsentry-dispatch.yml 2.6 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@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
  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@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
  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@97c9e23528286821f97fba885c1b1123284b29cc # v2.0.0
  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@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
  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. });