merge-pr-check
Note: If you have
mcporterinstalled locally, you should usemcporterto invoke the MCP tool instead of directly calling the MCP tool. ThemcporterCLI provides a more convenient interface and better error handling.
Merge PR Check via Gitee MCP
Check whether a Pull Request meets the criteria for merging, then execute the merge after confirmation.
Prerequisites
- Gitee MCP Server configured (tools:
get_pull_detail,list_pull_comments,get_diff_files,merge_pull) - User must provide: repository owner, repository name, PR number
Steps
Step 1: Fetch PR Status
Use get_pull_detail to retrieve PR details and check:
Basic status
- Whether the PR is open (stop if already closed/merged)
- Whether it is a Draft — if so, inform the user it must be converted to a regular PR first
- Whether source and target branches are correct
Pre-merge checklist
- Whether the PR has a description explaining the purpose of the changes
- Whether a reviewer has been assigned
Step 2: Analyze Comments and Review Feedback
Use list_pull_comments to retrieve all comments and check:
- Whether any reviewer has explicitly objected to merging (e.g., "NACK", "needs changes", "do not merge")
- Whether there are unresolved discussions (questions raised but not replied to)
- Whether there are any LGTM or Approved responses
Step 3: Quick Diff Check
Use get_diff_files to inspect changed files:
- Whether there are obvious omissions (e.g., code changed but related config not updated)
- Whether unexpected files are included (debug code, temp files)
- Whether the scope of changes matches the PR description
Step 4: Provide Merge Recommendation
Based on the checks above, output a merge assessment report:
## PR Merge Check Report
**PR**: #[number] [title]
**Status**: [Open/Draft/Closed]
### Checklist
✅ PR is in Open state
✅ Has a change description
⚠️ No reviewer approval yet
✅ Diff scope is reasonable
### Conclusion
[Ready to merge / Recommend waiting for review / Not recommended to merge]
Reason: [Specific explanation]
Step 5: Execute Merge (requires user confirmation)
If the checks pass, ask the user to confirm the merge.
After confirmation, use merge_pull with these parameters:
merge_method: merge strategy —merge(creates a merge commit),squash(squashes commits), orrebase- Default recommendation:
merge; suggestsquashif the PR has many messy commits
- Default recommendation:
commit_message: merge commit message (optional, defaults to PR title)
After a successful merge, output the result and ask whether the user wants to delete the source branch.
Notes
- Merging is irreversible — always wait for explicit user confirmation before proceeding
- If there are conflicts, the Gitee API will return an error — prompt the user to resolve conflicts first
- It is recommended to confirm that CI has passed before merging (check the PR's status checks)
More from oschina/gitee-agent-skills
repo-explorer
Use this skill when the user asks to explore a repository, get familiar with a project, "repo explorer", "tell me about this repo", "repo-explorer", "what does this repository do", or wants an overview of a Gitee repository. Requires Gitee MCP Server to be configured.
71daily-digest
Use this skill when the user asks for a daily summary, today's to-dos, "what's on my plate today", "daily digest", "daily-digest", "show my notifications", "pending PRs and issues". Requires Gitee MCP Server to be configured.
68review-pr
Use this skill when the user asks to review a PR, do a code review, check a pull request, "review this PR", "review-pr", or "look at this pull request". Requires Gitee MCP Server to be configured.
61create-pr
Use this skill when the user asks to create a PR, open a pull request, "create-pr", "submit a pull request", or "open a merge request". Requires Gitee MCP Server to be configured.
57close-issue-flow
Use this skill when the user asks to close an issue, wrap up an issue, "close issue", "close-issue-flow", or finish up after a fix has been merged. Requires Gitee MCP Server to be configured.
55search-and-fork
Use this skill when the user asks to search for and fork an open source repository, "find me an open source project", "search and fork", "search-and-fork", "find a similar project on Gitee", or "fork a repository". Requires Gitee MCP Server to be configured.
54