sentry-pull-request-bot.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. name: sentry pull request bot
  2. # Note this event happens on Issue comments AND PR comments,
  3. # we make sure that we only respond to PR comments.
  4. on:
  5. issue_comment:
  6. types: [created, edited]
  7. pull_request:
  8. types: [opened, edited]
  9. jobs:
  10. # TODO(billy): Move this into an external action as we add more functionality
  11. test-getsentry:
  12. name: test getsentry
  13. runs-on: ubuntu-20.04
  14. # Ensure this bot only responds for pull requests and only for the main repository
  15. if: >-
  16. (github.event.issue.pull_request.url != '' || github.event.pull_request.id != '') &&
  17. (contains(github.event.comment.body, '#test-getsentry') || contains(github.event.pull_request.body, '#test-getsentry')) &&
  18. github.repository == 'getsentry/sentry'
  19. steps:
  20. - name: Check getsentry membership
  21. id: org
  22. uses: actions/github-script@f05a81df23035049204b043b50c3322045ce7eb3 # v3
  23. with:
  24. script: |
  25. try {
  26. const result = await github.orgs.checkMembershipForUser({
  27. org: 'getsentry',
  28. username: context.payload.sender.login,
  29. })
  30. return result.status == 204;
  31. } catch {
  32. return false;
  33. }
  34. - name: Fetch getsentry token
  35. if: steps.org.outputs.result == 'true'
  36. id: getsentry
  37. uses: getsentry/action-github-app-token@38a3ce582e170ddfe8789f509597c6944f2292a9 # v1
  38. with:
  39. app_id: ${{ secrets.SENTRY_INTERNAL_APP_ID }}
  40. private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
  41. - name: Dispatch getsentry tests
  42. if: steps.org.outputs.result == 'true'
  43. uses: actions/github-script@f05a81df23035049204b043b50c3322045ce7eb3 # v3
  44. with:
  45. github-token: ${{ steps.getsentry.outputs.token }}
  46. script: |
  47. github.actions.createWorkflowDispatch({
  48. owner: 'getsentry',
  49. repo: 'getsentry',
  50. workflow_id: 'acceptance.yml',
  51. ref: 'master',
  52. inputs: {
  53. 'sentry-sha': '${{ github.event.pull_request.head.sha }}',
  54. }
  55. })