Skip to content

Commit eaf8d14

Browse files
author
vividcoder
committed
fix(ci): use pull_request_target to fix fork PR permission issue
Switch from pull_request to pull_request_target event so the workflow token has write permission to post PR comments on fork PRs. Add repository and ref parameters to checkout the PR head code correctly.
1 parent 18d032f commit eaf8d14

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

.github/workflows/coverage-check.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Coverage Check
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
branches: [ 'develop', 'release_**' ]
66
types: [ opened, synchronize, reopened ]
77

@@ -28,6 +28,9 @@ jobs:
2828

2929
steps:
3030
- uses: actions/checkout@v4
31+
with:
32+
repository: ${{ github.event.pull_request.head.repo.full_name }}
33+
ref: ${{ github.event.pull_request.head.sha }}
3134

3235
- name: Set up JDK 8
3336
uses: actions/setup-java@v4

0 commit comments

Comments
 (0)