Loading...
Loading...
Code commit, PR creation, merge, and issue closure workflow via GitHub CLI (gh). Triggers after a goal (GitHub Issue) implementation is complete — commit code, push branch, create PR, merge, then close the issue. Use when the user says "提交代码", "commit and merge", "创建PR", "合入", "关闭issue", "ship-it", or when a goal implementation is done and code needs to be shipped.
npx skill4agent add smallnest/goal-workflow ship-it#42gh auth status# 1a. 检查变更状态
git status
git diff --stat HEAD
# 1b. 暂存本次 Issue 相关的文件(不要 add 不相关的文件)
git add <files related to this issue>
# 1c. 提交,commit message 关联 Issue
git commit -m "$(cat <<'EOF'
{简要描述} (#issue-number)
{可选的详细说明}
EOF
)"#issue-number# 如果还在 main/master 上,先创建功能分支
git checkout -b {branch-name} # 如已在功能分支则跳过
# 推送到远程
git push -u origin {branch-name}feat/issue-42-short-descfix/issue-42-short-descgh pr create \
--title "{简要描述}" \
--body "$(cat <<'EOF'
## Summary
- 实现内容概述
Closes #{issue-number}
## Test plan
- [ ] 测试项 1
- [ ] 测试项 2
EOF
)"Closes #NFixes #N# 4a. 查看 PR 状态(确认 checks 通过)
gh pr checks
# 4b. 合入(默认 merge commit,可选 --squash 或 --rebase)
gh pr merge --squash --delete-branch--squash--rebase--merge--delete-branchCloses #N# 5a. 添加完成评论
gh issue comment {issue-number} --body "$(cat <<'EOF'
## 实现总结
- **核心变更**:说明
- **PR**: #{pr-number}
EOF
)"
# 5b. 关闭 Issue
gh issue close {issue-number} --reason completed| 场景 | 处理方式 |
|---|---|
| 查看失败原因,修复后追加 commit 推送 |
| PR 有 merge conflict | |
| 确认 required reviews 已满足,或请 reviewer approve |
| Issue 合入后未自动关闭 | 确认 PR body 包含 |
# 创建分支并提交
git checkout -b feat/issue-42-case-model
git add cases/case.go cases/case_test.go
git commit -m "$(cat <<'EOF'
Add Case data model and Markdown read/write (#42)
Define Case struct with YAML frontmatter + Markdown body
serialization. Provide WriteCase/ReadCase/ListCases/UpdateCase.
EOF
)"
# 推送
git push -u origin feat/issue-42-case-model
# 创建 PR
gh pr create \
--title "Add Case data model and Markdown read/write" \
--body "$(cat <<'EOF'
## Summary
- Define Case struct with YAML frontmatter + Markdown body
- Implement WriteCase/ReadCase/ListCases/UpdateCase functions
- Add comprehensive test coverage
Closes #42
## Test plan
- [x] Unit tests pass
- [x] go vet / lint clean
EOF
)"
# 确认 checks 通过后合入
gh pr checks
gh pr merge --squash --delete-branch
# 切回主分支
git checkout main
git pull