Skip to content

Commit b9e3e0b

Browse files
authored
ci: use pull_request_target for apidiff workflow to support fork PRs (#9605)
1 parent aeeb2a1 commit b9e3e0b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/apidiff.yaml

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

33
on:
4-
pull_request:
4+
# SECURITY: Using pull_request_target to support fork PRs with write permissions.
5+
# PR code is checked out but only for static analysis - it is never executed.
6+
# If modifying this workflow, ensure PR code is never executed and user inputs are not used unsafely.
7+
pull_request_target:
58
types: [opened, synchronize]
69
paths:
710
- 'pkg/**/*.go'
@@ -17,8 +20,11 @@ jobs:
1720
runs-on: ubuntu-24.04
1821
name: API Diff Check
1922
steps:
23+
# Checkout PR code for static analysis only
2024
- name: Checkout
2125
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
with:
27+
ref: ${{ github.event.pull_request.head.sha }}
2228

2329
- name: Set up Go
2430
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0

0 commit comments

Comments
 (0)