gh-merge

GitHub

自动化执行 GitHub PR 工作流,包括状态检查、精准提交、Rebase 冲突解决、PR 创建与监控、CI/CD 检查验证及安全合并。

agents/skills/gh-merge/SKILL.md AgentsMesh/AgentsMesh

触发场景

用户请求合并代码 用户请求提交更改 用户请求落地仓库变更

安装

npx skills add AgentsMesh/AgentsMesh --skill gh-merge -g -y
更多选项

非标准路径

npx skills add https://github.com/AgentsMesh/AgentsMesh/tree/main/agents/skills/gh-merge -g -y

不安装直接使用

npx skills use AgentsMesh/AgentsMesh@gh-merge

指定 Agent (Claude Code)

npx skills add AgentsMesh/AgentsMesh --skill gh-merge -a claude-code -g -y

安装 repo 全部 skill

npx skills add AgentsMesh/AgentsMesh --all -g -y

预览 repo 内 skill

npx skills add AgentsMesh/AgentsMesh --list

SKILL.md

Frontmatter
{
    "name": "gh-merge",
    "description": "Completes the AgentsMesh GitHub pull-request workflow: commits scoped changes, rebases on the authoritative GitHub branch, opens or reuses a PR, monitors required checks, fixes failures, and merges only after verification. Use when the user asks to merge, submit, or land repository changes."
}

GitHub Merge

GitHub is the development source of truth for this repository. Land changes through a GitHub pull request; do not create a GitLab merge request for product code.

Workflow

  1. Inspect repository state:

    git status --short --branch
    git branch --show-current
    git remote -v
    gh auth status --hostname github.com
    
  2. Identify the GitHub remote by URL instead of assuming a remote name. Resolve the target branch, normally main, and refuse to merge directly while checked out on that branch.

  3. Review all dirty files. Stage only files belonging to the requested change; preserve unrelated user changes and never use git add .. Run the relevant local tests and git diff --check, then create a focused commit containing only the requested change.

  4. Require a clean index and working tree before rebasing. If unrelated user changes remain, do not stash or move them automatically; use an already isolated checkout or stop and report what prevents a safe rebase. Once the checkout is clean, fetch and rebase on the current GitHub target:

    git fetch <github-remote> <target-branch>
    git rebase <github-remote>/<target-branch>
    

    Resolve conflicts with user-owned work preserved, then rerun affected tests when the rebase changes the integration base.

  5. Push the current branch. After a rebase, use --force-with-lease, never --force.

  6. Reuse an existing pull request for the branch or create one with gh pr create and the repository PR template. The title and body must explain behavior, verification, and any remaining risk.

  7. Inspect review state and wait for checks:

    gh pr checks <pr-number> --watch --interval 15 --fail-fast
    

    At least one check must be observed. If no checks are reported, retry after the workflow trigger delay; no checks is not a passing state. Diagnose failures from run logs, fix them, push, and monitor again.

  8. Merge only when all observed checks have completed successfully, reviews and branch policy allow it, and the PR is conflict-free:

    gh pr merge <pr-number> --squash --delete-branch
    
  9. Verify the remote PR state is MERGED. In a worktree, failure to delete the local branch does not mean the remote merge failed; report cleanup separately.

Result

Report the PR URL, source and target branches, commit, local tests, remote check results, merge method, and any local branch or worktree that remains.

版本历史

  • 9fc2f49 当前 2026-07-24 21:57

同 Skill 集合

agents/skills/arch-check/SKILL.md
agents/skills/e2e/SKILL.md
agents/skills/github-gitlab-mirror/SKILL.md
agents/skills/worktree/SKILL.md

元信息

文件数
0
版本
1f90b14
Hash
2ebe4f46
收录时间
2026-07-24 21:57

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-17 20:13
浙ICP备14020137号-1