Repository navigation
chore(AIAgent): simplify GitHub Issue/PR publishing workflow - #8869
Conversation
Reviewer's GuideDocumentationReplace the extensive Issue/PR publishing guide with a concise workflow for creating a linked Issue and new PR from an already-pushed branch.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8869 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 664 664
Lines 30484 30484
=========================================
Hits 30484 30484
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Linked issuesChecked at commit b7262bb #8868 chore(AIAgent): simplify GitHub Issue/PR skill workflow · 4 of 4 met
|
There was a problem hiding this comment.
Hey - I've found 6 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".agents/skills/github-issue-pr/SKILL.md" line_range="13" />
<code_context>
-
-PR 创建请求报错后,先按第 2 节在目标仓库查询匹配的 head 和 base,确认尚未创建且故障已排除后再重试。返回已创建、复用或更新的链接。流程受阻时,说明已完成的操作和受阻步骤。
+1. 确认目标仓库及其默认分支,使用 `gh` 检查登录状态。当前分支必须是非默认分支,且已推送到目标仓库或其 Fork;远端分支必须与本地 `HEAD` 一致。未提交的改动不属于 PR,存在影响本次发布的未提交改动时停止。
+2. 只读核对当前分支相对默认分支的提交和差异,确认有改动可发布。搜索是否已有匹配的打开 Issue;有则复用并记录编号,没有则在步骤 3 创建。不要更新已有 Issue。
+3. 读取 [Issue 表单](../../../.github/ISSUE_TEMPLATE/)、[PR 模板](../../../.github/pull_request_template.md)及 `.github/PULL_REQUEST_TEMPLATE/` 中的适用模板,参考近期同类 Issue 和 PR 的惯例。需要新建 Issue 时,根据实际差异创建,使用 `gh issue create --repo <目标仓库>`。
+4. 每次都创建新的 PR,不复用或更新已有 PR。检查同一 head 和 base 是否已有打开的 PR;GitHub 不允许对相同 head/base 并存多个打开的 PR,若已存在则停止并说明无法新建,不要改为复用或更新。使用 `gh pr create --repo <目标仓库>`,以当前远端分支为 head、默认分支为 base。分支名可能包含 `/`,始终将完整分支名作为一个值传递;Fork 的 head 格式为 `<owner>:<完整分支名>`,冒号用于分隔仓库所有者与分支名,不要按斜杠拆分分支名。保留 PR 模板的标题、注释、清单和顺序,在 `Link issues` 中填写 `fixes #<编号>`;跨仓库 Issue 使用 `fixes <owner>/<repo>#<编号>`。按实际改动和已知验证结果填写正文,不勾选未完成的项目。
</code_context>
<issue_to_address>
**Unrelated changes enter the PR**
When the branch contains commits or changes unrelated to the publishing task, `ip` accepts any publishable branch difference, and the workflow creates the PR from the whole branch, so unrelated commits and changes are included in the PR.
Limit the published diff to changes for the current task before creating the Issue and PR.
</issue_to_address>
### Comment 2
<location path=".agents/skills/github-issue-pr/SKILL.md" line_range="12-15" />
<code_context>
+1. 确认目标仓库及其默认分支,使用 `gh` 检查登录状态。当前分支必须是非默认分支,且已推送到目标仓库或其 Fork;远端分支必须与本地 `HEAD` 一致。未提交的改动不属于 PR,存在影响本次发布的未提交改动时停止。
</code_context>
<issue_to_address>
**Unreviewed commits enter the PR**
When another actor pushes to the head branch after the workflow checks it, `ir` creates the PR from the live branch name rather than the checked commit, so the PR includes changes that were not part of the reviewed diff or Issue description.
Create the PR from the exact reviewed commit, or stop and repeat the review if the branch tip changes.
</issue_to_address>
### Comment 3
<location path=".agents/skills/github-issue-pr/SKILL.md" line_range="13" />
<code_context>
-
-PR 创建请求报错后,先按第 2 节在目标仓库查询匹配的 head 和 base,确认尚未创建且故障已排除后再重试。返回已创建、复用或更新的链接。流程受阻时,说明已完成的操作和受阻步骤。
+1. 确认目标仓库及其默认分支,使用 `gh` 检查登录状态。当前分支必须是非默认分支,且已推送到目标仓库或其 Fork;远端分支必须与本地 `HEAD` 一致。未提交的改动不属于 PR,存在影响本次发布的未提交改动时停止。
+2. 只读核对当前分支相对默认分支的提交和差异,确认有改动可发布。搜索是否已有匹配的打开 Issue;有则复用并记录编号,没有则在步骤 3 创建。不要更新已有 Issue。
+3. 读取 [Issue 表单](../../../.github/ISSUE_TEMPLATE/)、[PR 模板](../../../.github/pull_request_template.md)及 `.github/PULL_REQUEST_TEMPLATE/` 中的适用模板,参考近期同类 Issue 和 PR 的惯例。需要新建 Issue 时,根据实际差异创建,使用 `gh issue create --repo <目标仓库>`。
+4. 每次都创建新的 PR,不复用或更新已有 PR。检查同一 head 和 base 是否已有打开的 PR;GitHub 不允许对相同 head/base 并存多个打开的 PR,若已存在则停止并说明无法新建,不要改为复用或更新。使用 `gh pr create --repo <目标仓库>`,以当前远端分支为 head、默认分支为 base。分支名可能包含 `/`,始终将完整分支名作为一个值传递;Fork 的 head 格式为 `<owner>:<完整分支名>`,冒号用于分隔仓库所有者与分支名,不要按斜杠拆分分支名。保留 PR 模板的标题、注释、清单和顺序,在 `Link issues` 中填写 `fixes #<编号>`;跨仓库 Issue 使用 `fixes <owner>/<repo>#<编号>`。按实际改动和已知验证结果填写正文,不勾选未完成的项目。
</code_context>
<issue_to_address>
**Existing issues block PR creation**
When a matching Issue exists but no matching open PR exists, `ip` stops after finding and reusing the Issue, so the workflow never reaches `ir` to create the linked PR; callers receive only the Issue link.
Continue to PR creation with the reused Issue number instead of stopping at step 2.
</issue_to_address>
### Comment 4
<location path=".agents/skills/github-issue-pr/SKILL.md" line_range="14" />
<code_context>
-PR 创建请求报错后,先按第 2 节在目标仓库查询匹配的 head 和 base,确认尚未创建且故障已排除后再重试。返回已创建、复用或更新的链接。流程受阻时,说明已完成的操作和受阻步骤。
+1. 确认目标仓库及其默认分支,使用 `gh` 检查登录状态。当前分支必须是非默认分支,且已推送到目标仓库或其 Fork;远端分支必须与本地 `HEAD` 一致。未提交的改动不属于 PR,存在影响本次发布的未提交改动时停止。
+2. 只读核对当前分支相对默认分支的提交和差异,确认有改动可发布。搜索是否已有匹配的打开 Issue;有则复用并记录编号,没有则在步骤 3 创建。不要更新已有 Issue。
+3. 读取 [Issue 表单](../../../.github/ISSUE_TEMPLATE/)、[PR 模板](../../../.github/pull_request_template.md)及 `.github/PULL_REQUEST_TEMPLATE/` 中的适用模板,参考近期同类 Issue 和 PR 的惯例。需要新建 Issue 时,根据实际差异创建,使用 `gh issue create --repo <目标仓库>`。
+4. 每次都创建新的 PR,不复用或更新已有 PR。检查同一 head 和 base 是否已有打开的 PR;GitHub 不允许对相同 head/base 并存多个打开的 PR,若已存在则停止并说明无法新建,不要改为复用或更新。使用 `gh pr create --repo <目标仓库>`,以当前远端分支为 head、默认分支为 base。分支名可能包含 `/`,始终将完整分支名作为一个值传递;Fork 的 head 格式为 `<owner>:<完整分支名>`,冒号用于分隔仓库所有者与分支名,不要按斜杠拆分分支名。保留 PR 模板的标题、注释、清单和顺序,在 `Link issues` 中填写 `fixes #<编号>`;跨仓库 Issue 使用 `fixes <owner>/<repo>#<编号>`。按实际改动和已知验证结果填写正文,不勾选未完成的项目。
+5. 回读 Issue 和 PR,确认链接、head、base 和 Issue 关联并返回链接。创建请求报错时先查询远端,确认未创建后才能重试;状态无法确认时如实报告。
</code_context>
<issue_to_address>
**Duplicate PR leaves an orphaned issue**
When no matching Issue exists and an open PR already has the same head and base, `iq` creates an Issue before `ir` detects the existing PR and stops, leaving an Issue with no new PR linked to it.
Check for an existing head/base PR before creating an Issue, and stop without creating one when a PR already exists.
Also at `.agents/skills/github-issue-pr/SKILL.md:15`.
</issue_to_address>
### Comment 5
<location path=".agents/skills/github-issue-pr/SKILL.md" line_range="13-14" />
<code_context>
-
-PR 创建请求报错后,先按第 2 节在目标仓库查询匹配的 head 和 base,确认尚未创建且故障已排除后再重试。返回已创建、复用或更新的链接。流程受阻时,说明已完成的操作和受阻步骤。
+1. 确认目标仓库及其默认分支,使用 `gh` 检查登录状态。当前分支必须是非默认分支,且已推送到目标仓库或其 Fork;远端分支必须与本地 `HEAD` 一致。未提交的改动不属于 PR,存在影响本次发布的未提交改动时停止。
+2. 只读核对当前分支相对默认分支的提交和差异,确认有改动可发布。搜索是否已有匹配的打开 Issue;有则复用并记录编号,没有则在步骤 3 创建。不要更新已有 Issue。
+3. 读取 [Issue 表单](../../../.github/ISSUE_TEMPLATE/)、[PR 模板](../../../.github/pull_request_template.md)及 `.github/PULL_REQUEST_TEMPLATE/` 中的适用模板,参考近期同类 Issue 和 PR 的惯例。需要新建 Issue 时,根据实际差异创建,使用 `gh issue create --repo <目标仓库>`。
+4. 每次都创建新的 PR,不复用或更新已有 PR。检查同一 head 和 base 是否已有打开的 PR;GitHub 不允许对相同 head/base 并存多个打开的 PR,若已存在则停止并说明无法新建,不要改为复用或更新。使用 `gh pr create --repo <目标仓库>`,以当前远端分支为 head、默认分支为 base。分支名可能包含 `/`,始终将完整分支名作为一个值传递;Fork 的 head 格式为 `<owner>:<完整分支名>`,冒号用于分隔仓库所有者与分支名,不要按斜杠拆分分支名。保留 PR 模板的标题、注释、清单和顺序,在 `Link issues` 中填写 `fixes #<编号>`;跨仓库 Issue 使用 `fixes <owner>/<repo>#<编号>`。按实际改动和已知验证结果填写正文,不勾选未完成的项目。
+5. 回读 Issue 和 PR,确认链接、head、base 和 Issue 关联并返回链接。创建请求报错时先查询远端,确认未创建后才能重试;状态无法确认时如实报告。
</code_context>
<issue_to_address>
**Concurrent runs create duplicate issues**
When two runs publish the same branch and both pass the duplicate checks before either creates an Issue, both runs create an Issue, but only one PR can be opened for that head/base pair, leaving a duplicate Issue and a run without its intended linked PR.
Serialize publishing runs for the same head/base pair and recheck for an Issue or PR immediately before creating either.
</issue_to_address>
### Comment 6
<location path=".agents/skills/github-issue-pr/SKILL.md" line_range="10" />
<code_context>
+遵守根 [AGENTS.md](../../../AGENTS.md) 和 [提交与 PR 指南](../../../docs/agents/pr-guide.md)。直接调用本 skill 即授权为当前分支复用或创建 Issue,并创建关联的新 PR。
-## 确认任务范围
+本 skill 只创建 Issue 和 PR,不修改代码或现有 Issue、PR,不创建或切换分支,不提交、推送、合并,也不运行构建或测试。无法直接创建时停止并说明原因。
-- 直接调用本 skill 且未指定其他 Issue 或 PR 操作时,按当前分支相对目标仓库默认分支的待发布差异,先创建新 Issue,再创建指向默认分支并关联该 Issue 的新 PR。直接调用即授权完成这套发布流程。
</code_context>
<issue_to_address>
**Existing updates have no supported workflow**
When a caller requests an update to an existing Issue or PR, the skill forbids modifying existing Issues and PRs, so it cannot fulfill update requests even though `AGENTS.md:58` and `docs/agents/pr-guide.md:13` direct those requests to this skill as the repository workflow.
Update the guidance to route existing-Issue/PR updates to a separate workflow, or restore update support in this skill.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 6 findings to address first, and if the workflow creates an Issue or PR with incorrect content or against the wrong target, that content is published on GitHub and may trigger notifications; reverting this skill change does not remove what was already created. The records can be corrected or closed, but the publication itself cannot be fully taken back.
Blocking findings: .agents/skills/github-issue-pr/SKILL.md:13, .agents/skills/github-issue-pr/SKILL.md:15, .agents/skills/github-issue-pr/SKILL.md:13, .agents/skills/github-issue-pr/SKILL.md:14, .agents/skills/github-issue-pr/SKILL.md:14, and 1 more
Link issues
fixes #8868
Summary By Copilot
github-issue-prguide with a concise workflow for publishing an already-pushed branch as a linked Issue and new PR.Regression?
Risk
Documentation-only change to the agent workflow; no runtime behavior changes.
Verification
Reviewed the committed skill diff against repository guidance. Build and tests were not run; this skill task does not run them.
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Streamline the GitHub Issue and PR publishing workflow around creating a new linked Issue and PR from an existing pushed branch.
Enhancements:
Documentation: