Help us improve
Share bugs, ideas, or general feedback.
From external-gitcode-ascend-skills
Automates the full GitCode open-source contribution workflow: local commit, push, issue creation, PR, pipeline checks, code review with /lgtm and /approve, and merge.
npx claudepluginhub ascend-ai-coding/awesome-ascend-skills --plugin mindspeed-llm-train-profilerHow this skill is triggered — by the user, by Claude, or both
Slash command
/external-gitcode-ascend-skills:gitcode-merge-flowThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
自动化完成从本地提交到代码合入开源仓的完整流程。当需要向 GitCode 开源仓库贡献代码时调用此 Skill。
Open-source pull request creation: PR descriptions, titles, fork workflows, and contribution compliance. Invoke whenever task involves any interaction with pull requests for external repositories — contributing code, opening PRs from forks, writing PR descriptions, or preparing changes for upstream submission.
Automates GitHub workflow: branching, committing, pushing, PRs, issues, and code review. Use when managing git operations or GitHub development lifecycle.
Creates or updates a GitHub PR or GitLab MR from the current branch using Conventional PR format. Use when a branch is ready for review or to update an existing PR/MR.
Share bugs, ideas, or general feedback.
自动化完成从本地提交到代码合入开源仓的完整流程。当需要向 GitCode 开源仓库贡献代码时调用此 Skill。
执行前必须确认以下配置:
token 文件读取,或由用户提供owner/repo,如 skywang2/skill-test)owner/repo,如 lyzin/111)https://api.gitcode.com/api/v5flowchart TD
A["本地提交"] --> B["远程推送"]
B --> C["提交Issue"]
C --> D["提交PR"]
D --> E["触发流水线"]
E --> F{"存在流水线失败问题?"}
F -->|是| G["解决流水线失败问题"]
G --> E
F -->|否| H["等待代码评审"]
H --> I{"存在未解决评审意见?"}
I -->|是| J["解决评审意见"]
J --> H
I -->|否| K{"存在新提交解决的评审意见?"}
K -->|是| E
K -->|否| L["等待/lgtm和/approve"]
L --> M["确认合入"]
token 文件获取 GITCODE_ACCESS_TOKEN,若不存在则向用户索取.git 目录是否存在)owner/repo 格式): 如 skywang2/skill-testowner/repo 格式): 如 lyzin/111masterreferences/issue-templates.md 中的模板)references/pr-template.md 中的模板)git status 检查是否有未暂存的更改git add -A 暂存所有更改(或按用户指定文件)git commit -m "<commit_message>" 提交,commit_message 由用户提供或根据更改自动生成git remote -vgit remote add origin https://gitcode.com/<personal_owner>/<personal_repo>.gitgit push origin <current_branch>调用 GitCode API 在开源仓创建 Issue。
API 详情:请参考 references/api.md 中的「创建 Issue」部分。
执行脚本:使用 scripts/create_issue.py 脚本。
记录返回的 Issue 编号(number 字段),后续创建 PR 时关联。
调用 GitCode API 从个人仓向开源仓创建 PR。
API 详情:请参考 references/api.md 中的「创建 PR」部分。
执行脚本:使用 scripts/create_pr.py 脚本。
【重要】提交数限制:
git log --oneline origin/main..main记录返回的 PR 编号(number 字段),后续步骤均依赖此编号。
如果需要显式关联 PR 和 Issue,可以调用关联 API。
API 详情:请参考 references/api.md 中的「关联 PR 和 Issue」部分。
执行脚本:使用 scripts/link_pr_issue.py 脚本。
注意:此操作需要仓库维护者权限,普通贡献者可能无法执行。创建 PR 时设置 close_related_issue: true 可以自动关联 Issue。
PR 创建后流水线会自动触发。获取流水线状态并直接挂起,让用户自行确认。
API 详情:请参考 references/api.md 中的「获取 PR 详情」部分。
执行脚本:使用 scripts/get_pr_details.py 脚本(字段 mergeable_state.ci_state_passed)。
【挂起反馈示例 - 步骤6】:
⏸️ 流程已挂起 - 请确认流水线状态
📋 当前状态:
• PR 链接: https://gitcode.com/{owner}/{repo}/merge_requests/{number}
• 流水线状态: ✅ 通过 / ❌ 失败 / ⏳ 运行中
• 合并状态: ✅ 可合并 / ❌ 不可合并
⏳ 请确认:
请在 PR 页面确认流水线是否通过
流水线通过后请告知我继续流程
若流水线失败,请在修复后告知我
📝 流水线失败处理:
1. 修复代码问题
2. 执行 git add → git commit → git push 推送新提交
3. 新提交会自动重新触发流水线
4. 流水线通过后告知我继续
【强制要求】无论仓库配置如何,必须等待至少一个维护者进行代码评审通过后方可继续。
获取 PR 的评审评论并检查评审状态。
API 详情:请参考 references/api.md 中的「获取 PR 评论」部分。
执行脚本:使用 scripts/get_pr_comments.py 脚本。
评审状态判断逻辑:
resolved: false 的评论 → 有未解决的评审意见resolved: true → 评审意见已全部解决【挂起反馈示例 - 步骤7】: 当流程因等待评审而挂起时,必须向用户清晰展示:
⏸️ 流程已挂起 - 等待代码评审
📋 当前状态:
• PR 链接: https://gitcode.com/{owner}/{repo}/merge_requests/{number}
• 流水线状态: ✅ 通过
• 评审状态: ❌ 暂无评审评论 / ⚠️ 有未解决评审意见
⏳ 等待操作:
需要至少一个维护者进行代码评审
📝 下一步:
请联系仓库维护者进行评审
评审完成后请告知我,我将检查评审状态并继续流程
存在未解决评审意见:
git add → git commit → git push 推送新提交【强制要求】无论仓库配置如何,必须获得至少一个 /lgtm 或 /approve 评论表态后方可合入。
检查 PR 评论,确认是否有人通过评论 /lgtm 或 /approve 表示同意合入。
执行脚本:使用 scripts/get_pr_comments.py 脚本。
判断逻辑:
/lgtm 或 /approve → 挂起流程/lgtm 或 /approve → 进入步骤9【挂起反馈示例 - 步骤8】:
⏸️ 流程已挂起 - 等待 /lgtm 和 /approve 审批
📋 当前状态:
• PR 链接: https://gitcode.com/{owner}/{repo}/merge_requests/{number}
• 流水线状态: ✅ 通过
• 评审状态: ✅ 已通过
• 审批状态: ❌ 暂无 /lgtm 或 /approve
⏳ 等待操作:
需要仓库维护者通过评论 /lgtm 或 /approve 表示同意合入
📝 下一步:
请仓库维护者在 PR 页面评论 /lgtm 或 /approve
获得审批后请告知我,我将执行合并
所有条件满足后,调用 API 合入 PR。
API 详情:请参考 references/api.md 中的「合并 PR」部分。
执行脚本:使用 scripts/merge_pr.py 脚本。
【重要】合并方式:
merge_pr.py 脚本会自动检查 PR 的提交数量,若大于 1 则强制使用 squash合入成功后:
git pull upstream master流程中以下步骤需要等待第三方人工操作,会直接挂起:
| 挂起点 | 等待原因 | 恢复条件 |
|---|---|---|
| 步骤6: 流水线检查 | 需要用户确认流水线状态 | 用户确认流水线通过后告知我继续 |
| 步骤7: 等待评审 | 需要评审人审查代码 | 用户确认评审完成后告知我继续 |
| 步骤8: 等待 /lgtm 和 /approve | 需要维护者审批 | 用户确认已获得审批后告知我继续 |
挂起时的行为:
requests 库https://oauth2:<token>@gitcode.com/<owner>/<repo>.githead 参数必须包含个人仓 owner 前缀,格式为 <owner>:<branch>pip install requests