-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
74 lines (67 loc) · 2.66 KB
/
sentry-pull-request-bot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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-20.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@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
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@97c9e23528286821f97fba885c1b1123284b29cc # v2.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@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
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@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
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 }}',
}
})