Skip to content

Commit caea1f4

Browse files
committed
Combine event trigger workflows
1 parent 1db84c9 commit caea1f4

File tree

3 files changed

+44
-42
lines changed

3 files changed

+44
-42
lines changed

.github/workflows/pull_request_review_trigger.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/repository_dispatch_trigger.yaml

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Trigger test events
2+
3+
on:
4+
- pull_request
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
repository_dispatch:
11+
runs-on: ubuntu-24.04
12+
name: Trigger repository_dispatch event
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Repository Dispatch
17+
uses: peter-evans/repository-dispatch@v2
18+
with:
19+
event-type: test
20+
client-payload: '{"pull_request": { "url": "${{ github.event.pull_request.url }}" } }'
21+
22+
pull_request_review:
23+
runs-on: ubuntu-24.04
24+
name: Trigger pull_request_review event
25+
steps:
26+
- name: Trigger pull_request_review event
27+
env:
28+
PULL_REQUEST_URL: ${{ github.event.pull_request.url }}
29+
run: |
30+
cat >review.json <<EOF
31+
{
32+
"body": "Triggering pull_request_review event...",
33+
"event": "COMMENT"
34+
}
35+
EOF
36+
37+
curl \
38+
--request POST \
39+
-H "Authorization: token ${{ secrets.REVIEW_GITHUB_TOKEN }}" \
40+
-H "Accept: application/vnd.github.v3+json" \
41+
-H "User-Agent: terraform-github-actions" \
42+
-H "Content-Type: application/json" \
43+
--data-binary @review.json \
44+
"${PULL_REQUEST_URL}/reviews"

0 commit comments

Comments
 (0)