name: sentry pull request bot # Note this event happens on Issue comments AND PR comments, # we make sure that we only respond to PR comments. on: issue_comment: types: [created, edited] pull_request: types: [opened, edited] jobs: # TODO(billy): Move this into an external action as we add more functionality test-getsentry: name: test getsentry runs-on: ubuntu-22.04 # Ensure this bot only responds for pull requests and only for the main repository if: >- (github.event.issue.pull_request.url != '' || github.event.pull_request.id != '') && (contains(github.event.comment.body, '#test-getsentry') || contains(github.event.pull_request.body, '#test-getsentry')) && github.repository == 'getsentry/sentry' steps: - name: Check getsentry membership id: org uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: script: | try { const result = await github.rest.orgs.checkMembershipForUser({ org: 'getsentry', username: context.payload.sender.login, }) return result.status == 204; } catch { return false; } - name: Fetch getsentry token if: steps.org.outputs.result == 'true' id: getsentry uses: getsentry/action-github-app-token@d4b5da6c5e37703f8c3b3e43abb5705b46e159cc # v3.0.0 with: app_id: ${{ vars.SENTRY_INTERNAL_APP_ID }} private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }} - name: Wait for PR merge commit uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 id: mergecommit with: github-token: ${{ steps.getsentry.outputs.token }} script: | require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/scripts/wait-for-merge-commit`).waitForMergeCommit({ github, context, core, }); - name: Dispatch getsentry tests if: steps.org.outputs.result == 'true' uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: github-token: ${{ steps.getsentry.outputs.token }} script: | github.rest.actions.createWorkflowDispatch({ owner: 'getsentry', repo: 'getsentry', workflow_id: 'acceptance.yml', ref: 'master', inputs: { 'sentry-sha': '${{ steps.mergecommit.outputs.mergeCommitSha }}', 'sentry-pr-sha': '${{ github.event.pull_request.head.sha }}', } })