-
Notifications
You must be signed in to change notification settings - Fork 5
90 lines (82 loc) · 2.79 KB
/
comment-trigger.yml
File metadata and controls
90 lines (82 loc) · 2.79 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Comment Trigger
on:
issue_comment:
types: [created]
permissions:
contents: read
pull-requests: write
actions: write
jobs:
trigger-checks:
name: Trigger Checks from Comment
if: |
github.event.issue.pull_request &&
(github.event.comment.body == '/test all' ||
github.event.comment.body == '/test-all' ||
github.event.comment.body == '/run-all-checks') &&
(github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR')
runs-on: ubuntu-latest
steps:
- name: Get PR branch
uses: actions/github-script@v7
id: get-pr
with:
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
return pr.data.head.ref;
- name: Add reaction to comment
uses: actions/github-script@v7
with:
script: |
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: 'rocket'
});
- name: Trigger Python CI
uses: actions/github-script@v7
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'python.yml',
ref: '${{ fromJSON(steps.get-pr.outputs.result) }}'
});
- name: Trigger Go CI
uses: actions/github-script@v7
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'go.yml',
ref: '${{ fromJSON(steps.get-pr.outputs.result) }}'
});
- name: Trigger TypeScript CI
uses: actions/github-script@v7
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'typescript.yml',
ref: '${{ fromJSON(steps.get-pr.outputs.result) }}'
});
- name: Comment on PR
uses: actions/github-script@v7
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: '🚀 All CI checks triggered! Check the Actions tab for progress.'
});