|
@@ -0,0 +1,61 @@
|
|
|
+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-16.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@v3
|
|
|
+ with:
|
|
|
+ script: |
|
|
|
+ try {
|
|
|
+ const result = await github.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@v1
|
|
|
+ with:
|
|
|
+ app_id: ${{ secrets.SENTRY_INTERNAL_APP_ID }}
|
|
|
+ private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
|
|
|
+
|
|
|
+ - name: Dispatch getsentry tests
|
|
|
+ if: steps.org.outputs.result == 'true'
|
|
|
+ uses: actions/github-script@v3
|
|
|
+ with:
|
|
|
+ github-token: ${{ steps.getsentry.outputs.token }}
|
|
|
+ script: |
|
|
|
+ github.actions.createWorkflowDispatch({
|
|
|
+ owner: 'getsentry',
|
|
|
+ repo: 'getsentry',
|
|
|
+ workflow_id: 'acceptance.yml',
|
|
|
+ ref: 'master',
|
|
|
+ inputs: {
|
|
|
+ 'sentry-sha': '${{ github.event.pull_request.head.sha }}',
|
|
|
+ }
|
|
|
+ })
|