Skip to content

Commit b23a9e5

Browse files
ccojocarclaude
andauthored
fix: allow barry action to access secrets on fork PRs (#1616)
Use pull_request_target event so the GOOGLE_API_KEY secret is available when PRs come from forks. Checkout the PR head SHA explicitly since pull_request_target defaults to the base branch. Guard other jobs to skip on pull_request_target to avoid duplicate runs. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 355cfa5 commit b23a9e5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ on:
66
pull_request:
77
branches:
88
- master
9+
pull_request_target:
10+
branches:
11+
- master
912
jobs:
1013
test:
14+
if: github.event_name != 'pull_request_target'
1115
strategy:
1216
matrix:
1317
version:
@@ -44,6 +48,7 @@ jobs:
4448
- name: Perf Diff
4549
run: make perf-diff
4650
taint-perf-guard:
51+
if: github.event_name != 'pull_request_target'
4752
runs-on: ubuntu-latest
4853
env:
4954
GO111MODULE: on
@@ -64,14 +69,16 @@ jobs:
6469
- name: Check taint benchmark regression
6570
run: bash tools/check_taint_benchmark.sh
6671
barry-ai-security-review:
67-
if: github.event_name == 'pull_request'
72+
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
6873
runs-on: ubuntu-latest
6974
permissions:
7075
security-events: write
7176
pull-requests: write
7277
steps:
7378
- name: Checkout Source
7479
uses: actions/checkout@v6
80+
with:
81+
ref: ${{ github.event.pull_request.head.sha }}
7582
- name: Run Barry AI Security Review
7683
id: barry
7784
uses: ccojocar/barry@main
@@ -86,10 +93,11 @@ jobs:
8693
output-format: sarif
8794
- name: Upload SARIF to GitHub Security Center
8895
uses: github/codeql-action/upload-sarif@v4
89-
if: always()
96+
if: steps.barry.outcome == 'success'
9097
with:
9198
sarif_file: ${{ github.workspace }}/barry-results.sarif
9299
coverage:
100+
if: github.event_name != 'pull_request_target'
93101
needs: [test, taint-perf-guard]
94102
runs-on: ubuntu-latest
95103
env:

0 commit comments

Comments
 (0)