From ab609d32895d0c107bfeefcbf8965fbab7f79ba9 Mon Sep 17 00:00:00 2001 From: Chris233 Date: Sat, 23 May 2026 22:42:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20pr-agent.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-agent.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-agent.yml b/.github/workflows/pr-agent.yml index f1c709fb..18cbf16d 100644 --- a/.github/workflows/pr-agent.yml +++ b/.github/workflows/pr-agent.yml @@ -6,12 +6,15 @@ on: # 本 workflow 不 checkout / 执行 PR 分支代码,只让 digest-pinned PR-Agent 镜像通过 GitHub API 读取 diff。 pull_request_target: types: [opened, reopened, ready_for_review, synchronize] + + # 允许在 PR 或普通 Issue 里通过评论触发,例如 /ask issue_comment: types: [created] jobs: pr_agent_job: - # PR 与每次新 commit 自动运行;评论触发仍限制为可信成员,避免任意评论滥用 Secrets。 + # PR 自动运行; + # 评论触发时限制为可信成员,允许 PR 评论和普通 Issue 评论使用 /ask。 if: >- ${{ github.event.sender.type != 'Bot' && @@ -19,8 +22,8 @@ jobs: github.event_name == 'pull_request_target' || ( github.event_name == 'issue_comment' && - github.event.issue.pull_request && - contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association) + contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association) && + startsWith(github.event.comment.body, '/ask') ) ) }} @@ -65,4 +68,4 @@ jobs: github_action_config.auto_improve: "false" # 允许 synchronize 事件触发 PR-Agent - github_action_config.pr_actions: '["opened", "reopened", "ready_for_review", "synchronize"]' + github_action_config.pr_actions: '["opened", "reopened", "ready_for_review", "synchronize"]' \ No newline at end of file