Skip to content

Commit 360835e

Browse files
committed
Use pull_request_target for fork PR write access
The pull_request trigger has restricted GITHUB_TOKEN permissions for fork PRs (read-only). Using pull_request_target runs the workflow in the context of the base repository, providing write access to post PR comments. Added explicit ref to checkout the PR head SHA since pull_request_target defaults to checking out the base branch.
1 parent 96fc42d commit 360835e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.github/workflows/danger.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: danger
3-
on: pull_request
3+
on: pull_request_target
44

55
permissions:
66
contents: read
@@ -13,6 +13,7 @@ jobs:
1313
- uses: actions/checkout@v6
1414
with:
1515
fetch-depth: 0
16+
ref: ${{ github.event.pull_request.head.sha }}
1617
- name: Set up Ruby
1718
uses: ruby/setup-ruby@v1
1819
with:

0 commit comments

Comments
 (0)