fix(ci): use pull_request_target so Qodo review runs on fork PRs#816
Merged
fix(ci): use pull_request_target so Qodo review runs on fork PRs#816
Conversation
pull_request event blocks fork PRs behind manual approval and denies access to secrets, so DOUBAO_API_KEY is unavailable and the review silently fails. pull_request_target runs in the base-repo context, giving the workflow access to secrets while still executing the workflow file from main (not from the fork), which keeps the API key safe.
zhoujh01
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
将
pr-review.yml的触发事件从pull_request改为pull_request_target,使 Qodo PR Review 能在所有 fork PR 上自动运行。Related Issue
N/A
Type of Change
Changes Made
pr-review.yml的pull_request事件改为pull_request_targetTesting
Checklist
Screenshots (if applicable)
N/A
Additional Notes
问题
当前
pull_request事件下,来自外部贡献者的 fork PR 会被 GitHub 拦截(action_required),需要 maintainer 手动批准。即使批准后,secrets.DOUBAO_API_KEY在 fork PR 的pull_request事件中也不可用,导致 Qodo review 无法调用 Doubao API。最近 100 次 workflow 运行中,有 13 次 fork PR 全部卡在
action_required状态。方案
pull_request_target在 base repo(main 分支)的上下文中运行 workflow,因此:secrets.DOUBAO_API_KEY安全性
actions/checkout@v4在pull_request_target下默认 checkout base branch,.pr_agent.toml也来自 main🤖 Generated with Claude Code