Skip to content

Commit 60df735

Browse files
authored
fix(ci): support fork PRs via pull_request_target in ai-review workflow (#133)
1 parent 313c93d commit 60df735

3 files changed

Lines changed: 22 additions & 5 deletions

File tree

.fork/features/ci.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,18 @@ Verification:
5454
- Env var names cross-checked against `action.yml`, `docs/configs/.ai-review.yaml`,
5555
and `docs/ci/github.yaml` from the upstream repo.
5656
- v0.69.0 confirmed as latest release (July 8, 2026).
57+
58+
## 2026-09-03 — Support fork PRs via pull_request_target in AI PR Review workflow
59+
60+
Branch: `fix/ci-ai-review-pull-request-target`
61+
Files:
62+
- `.github/workflows/ai-review.yml`
63+
64+
Notes:
65+
- Replaces `on: pull_request` with `on: pull_request_target` so external contributor
66+
fork PRs receive repository secrets/variables and no longer crash with Pydantic
67+
validation errors.
68+
- Pins checkout ref to `github.event.pull_request.head.sha` with `actions/checkout@v4`.
69+
- Adds fallback between Secrets and Variables for `LLM_PROXY_URL`, `LLM_PROXY_API_KEY`,
70+
and `LLM_PROXY_MODEL`.
71+
- Uses sensible fallback model `codex/gpt-5.6-sol` if `LLM_PROXY_MODEL` is empty.

.fork/stack.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ rules:
5555
ci:
5656
- "feat(ci): fork-aware release notes with incremental topic diff"
5757
- "fix(ci): add AI PR review workflow"
58+
- "fix(ci): support fork PRs via pull_request_target in ai-review workflow"
5859
tooling:
5960
- "feat(tooling): add AGENTS.md and .agent/ config for linear stack workflow"
6061
- "fix(tooling): scope fork-stack gate to canonical branch and tolerate transient commits"

.github/workflows/ai-review.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
name: AI PR Review
2121

2222
on:
23-
pull_request:
23+
pull_request_target:
2424
types: [opened, synchronize, reopened]
2525
branches:
2626
- dev
@@ -40,23 +40,24 @@ jobs:
4040

4141
steps:
4242
- name: Checkout repository
43-
uses: actions/checkout@v6
43+
uses: actions/checkout@v4
4444
with:
4545
# Fetch full history so git diff operates correctly
4646
fetch-depth: 0
47+
ref: ${{ github.event.pull_request.head.sha }}
4748

4849
- name: Run AI Review
4950
uses: Nikita-Filonov/ai-review@v0.69.0
5051
env:
5152
# --- LLM Provider & Model Configuration ---
5253
LLM__PROVIDER: "OPENAI"
53-
LLM__META__MODEL: ${{ vars.LLM_PROXY_MODEL }}
54+
LLM__META__MODEL: ${{ vars.LLM_PROXY_MODEL || secrets.LLM_PROXY_MODEL || 'codex/gpt-5.6-sol' }}
5455
LLM__META__MAX_TOKENS: "15000"
5556
LLM__META__TEMPERATURE: "0.2"
5657

5758
# --- LLM Proxy Masked Routing ---
58-
LLM__HTTP_CLIENT__API_URL: ${{ secrets.LLM_PROXY_URL }}
59-
LLM__HTTP_CLIENT__API_TOKEN: ${{ secrets.LLM_PROXY_API_KEY }}
59+
LLM__HTTP_CLIENT__API_URL: ${{ secrets.LLM_PROXY_URL || vars.LLM_PROXY_URL }}
60+
LLM__HTTP_CLIENT__API_TOKEN: ${{ secrets.LLM_PROXY_API_KEY || vars.LLM_PROXY_API_KEY }}
6061
# Proxy adds a hop; extend timeout beyond the 120s default
6162
LLM__HTTP_CLIENT__TIMEOUT: "180"
6263

0 commit comments

Comments
 (0)