manage-pull-requests

通过 MCP 管理 Harness Code 的拉取请求,支持列出、创建、更新和合并 PR;添加审阅者并提交审阅决定(批准/请求更改);发布、更新和删除评论;读取讨论时间线;以及检查 CI 状态。用于打开、合并或审阅 PR、分配审阅者、发表评论或检查 PR 状态与活动。

仓库最近推送
GitHub Stars
138
Forks
30
Issues / PRs
4

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "manage-pull-requests":https://skillpi.com/zh/skills/deepskill-7b35995f18b77fb6a709169da5e61c1d977b624104e0320d54349478d8768254。安装前核对上游来源和版本:https://github.com/harness/harness-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

通过 MCP 管理 Harness Code 的拉取请求,支持列出、创建、更新和合并 PR;添加审阅者并提交审阅决定(批准/请求更改);发布、更新和删除评论;读取讨论时间线;以及检查 CI 状态。用于打开、合并或审阅 PR、分配审阅者、发表评论或检查 PR 状态与活动。

0 下载

介绍来源: third_party · harness · 1.0.0 参考来源

SkillPi 解读

能完成的任务
来源文档未说明。
适合谁
来源文档未说明。
输入和输出
来源文档未说明。
软件、账号及付费要求
来源文档未说明。
限制与区别
来源文档未说明。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: manage-pull-requests
description: >-
  Manage Harness Code pull requests via MCP. List, create, update, and merge PRs; add reviewers and
  submit review decisions (approve / request changes); post, update, and delete comments; read the
  discussion timeline; and check CI status. Use when asked to open a PR, merge a PR, approve a PR,
  leave a code review comment, request changes, assign reviewers, or inspect PR checks and activity.
  Trigger phrases: pull request, PR review, merge PR, approve PR, request changes, add reviewer,
  PR comments, PR checks, PR activity, code review.
metadata:
  author: Harness
  version: 1.0.0
  mcp-server: harness-mcp-v2
license: Apache-2.0
compatibility: Requires Harness MCP server (harness-mcp-v2)

Manage Pull Requests

Manage Harness Code pull requests, reviewers, comments, checks, and activity via MCP.

MCP Tools Used

Tool Resource Type Purpose
harness_list pull_request List PRs in a repo, filter by state
harness_get pull_request Get PR details by number
harness_create pull_request Open a new PR
harness_update pull_request Update PR title / description / state
harness_execute (action: merge) pull_request Merge a PR (merge/squash/rebase/fast-forward)
harness_list pr_reviewer List reviewers on a PR
harness_create pr_reviewer Add a reviewer to a PR
harness_execute (action: submit_review) pr_reviewer Submit an approved or changereq review
harness_create pr_comment Post a top-level or inline code comment
harness_update pr_comment Edit a comment
harness_delete pr_comment Delete a comment
harness_list pr_activity Read the discussion timeline — the only way to READ comments
harness_list pr_check List CI status checks on a PR
harness_schema any of the above Exact JSON Schema for create / update body fields

All pull-request resources are repo-scoped. Every call needs repo_id and pr_number (except harness_list for pull_request, which only needs repo_id). org_id / project_id are optional (the server infers them from the repo).

URL shortcut: the MCP server auto-extracts repo_id and pr_number if you pass a Harness PR URL via the url parameter — e.g. harness_get(resource_type="pull_request", url="https://app.harness.io/ng/account/.../pulls/42").

Instructions

Step 1: List or find the PR

Call MCP tool: harness_list
Parameters:
  resource_type: "pull_request"
  repo_id: "<repository_identifier>"
  state: "open"        # optional: open | closed | merged
  query: "<keyword>"   # optional: full-text search

Or fetch a specific PR:

Call MCP tool: harness_get
Parameters:
  resource_type: "pull_request"
  repo_id: "<repository_identifier>"
  pr_number: <number>

Step 2: Open a PR

Call MCP tool: harness_create
Parameters:
  resource_type: "pull_request"
  repo_id: "<repository_identifier>"
  body:
    title: "Fix race condition in scheduler"
    source_branch: "fix/scheduler-race"
    target_branch: "main"
    description: "Resolves HAR-1234. Adds mutex around queue access."

title, source_branch, target_branch are required. description supports markdown.

Step 3: Update PR metadata

Call MCP tool: harness_update
Parameters:
  resource_type: "pull_request"
  repo_id: "<repo>"
  pr_number: <number>
  body:
    title: "Updated title"
    description: "Updated description"
    state: "closed"     # optional: open | closed

All body fields are optional — only include what you want to change.

Step 4: Add reviewers

Call MCP tool: harness_create
Parameters:
  resource_type: "pr_reviewer"
  repo_id: "<repo>"
  pr_number: <number>
  body:
    reviewer_id: <numeric_user_id>

List current reviewers with harness_list(resource_type="pr_reviewer", repo_id, pr_number).

Step 5: Submit a review decision

Call MCP tool: harness_execute
Parameters:
  resource_type: "pr_reviewer"
  action: "submit_review"
  repo_id: "<repo>"
  pr_number: <number>
  body:
    decision: "approved"          # approved | changereq
    commit_sha: "<sha>"           # optional — the commit you reviewed

Step 6: Post a comment

Top-level comment:

Call MCP tool: harness_create
Parameters:
  resource_type: "pr_comment"
  repo_id: "<repo>"
  pr_number: <number>
  body:
    text: "LGTM with one nit — see inline."

Inline code comment:

Call MCP tool: harness_create
Parameters:
  resource_type: "pr_comment"
  repo_id: "<repo>"
  pr_number: <number>
  body:
    text: "This loop can leak if the context is cancelled."
    path: "scheduler/queue.go"
    line_new: 142
    source_commit_sha: "<source_sha>"
    target_commit_sha: "<target_sha>"

Use line_old for comments on removed lines.

Step 7: Read comments — use pr_activity, not pr_comment

The Harness Code API does not expose GET on /comments. To read the discussion, list PR activity filtered by kind:

Call MCP tool: harness_list
Parameters:
  resource_type: "pr_activity"
  repo_id: "<repo>"
  pr_number: <number>
  kind: "comment"        # just comments (general + code)
  # or type: "code-comment" for inline code review comments only

Other useful type filters: review-submit, reviewer-add, state-change, merge, title-change.

Step 8: Edit or delete a comment

Call MCP tool: harness_update
Parameters:
  resource_type: "pr_comment"
  repo_id: "<repo>"
  pr_number: <number>
  comment_id: <numeric_comment_id>
  body:
    text: "Updated comment body"
Call MCP tool: harness_delete
Parameters:
  resource_type: "pr_comment"
  repo_id: "<repo>"
  pr_number: <number>
  comment_id: <numeric_comment_id>

Step 9: Inspect CI checks

Call MCP tool: harness_list
Parameters:
  resource_type: "pr_check"
  repo_id: "<repo>"
  pr_number: <number>

Returns the status of each status check (pipeline, test run, external check) associated with the PR head commit. Use this before merging to confirm required checks are green.

Step 10: Merge

Call MCP tool: harness_execute
Parameters:
  resource_type: "pull_request"
  action: "merge"
  repo_id: "<repo>"
  pr_number: <number>
  body:
    method: "squash"               # merge | squash | rebase | fast-forward
    delete_source_branch: true
    dry_run: false
    source_sha: "<expected_sha>"   # optional optimistic lock

Set dry_run: true first to preview the merge without executing — useful before destructive merges.

Examples

Open a PR and request a review

/manage-pull-requests
Open a PR from feat/new-auth into main titled "Add OAuth device flow" on repo platformUI,
and add user 12345 as a reviewer.

Read all unresolved comments on a PR

/manage-pull-requests
Show me every inline code comment on PR 182 in repo harness-core so I can address them.

Approve and merge

/manage-pull-requests
Approve PR 47 in repo mcp-server with a "LGTM" comment, then squash-merge it and delete the branch.

Check CI before merging

/manage-pull-requests
List the checks on PR 99 in repo harness-cli. If they're all green, merge it with a squash.

Close a stale PR

/manage-pull-requests
Close PR 22 in repo harness-skills with a comment explaining we're going in a different direction.

Performance Notes

  • Always pass repo_id + pr_number together except for harness_list(pull_request) which only needs repo_id. Missing pr_number on per-PR calls returns a helpful 400 from the server.
  • Read comments via pr_activity, never pr_comment. The comments endpoint is POST-only. Use kind=comment for all discussion, type=code-comment for inline only.
  • Use dry_run: true on merge before destructive squash/rebase merges — especially on main branches with required checks.
  • Prefer the URL shortcut when the user pastes a PR link. url="<PR URL>" auto-extracts org_id, project_id, repo_id, and pr_number — fewer args to get wrong.
  • pr_reviewer.submit_review records a review independently of the reviewer list. You don't need to call harness_create(pr_reviewer) first to submit a review — any user with access can review.
  • Cross-scope search: harness_search(query="<text>", resource_types=["pull_request"]) finds PRs across repos when you don't know which repo contains it.

Troubleshooting

"repo_id is required"

All PR operations are repo-scoped. Pass the repo identifier (not the repo name) — list repos first with harness_list(resource_type="repository") if you're unsure.

Comments don't show up when I list them

pr_comment has no list/get operations. Use harness_list(resource_type="pr_activity", kind="comment") to read the discussion timeline.

"GET /comments not found" / 404 on reading a comment

Same cause as above — the Harness Code API is POST-only for /comments. Read via pr_activity.

Review decision rejected

Check the decision value — it must be exactly "approved" or "changereq". The API does not accept "approve" (no d) or "request_changes".

Merge fails with "source SHA mismatch"

You passed source_sha and it no longer matches the branch head (someone pushed after you computed it). Drop source_sha or re-fetch the PR to get the current source_sha.

Inline comment has no diff context

Inline code comments need both source_commit_sha and target_commit_sha in the body — without them the comment appears as a top-level comment. Get the SHAs from harness_get(pull_request) → source_sha / target_sha.

Required checks aren't passing but merge succeeded anyway

harness_execute(action=merge) bypasses branch protection if the caller has admin rights. Use harness_list(resource_type="pr_check") first and fail fast in automation if any check is not success.

当前收录版本

1.0.0

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值95/100

亮点

  • 提供完整的PR生命周期管理能力(创建、更新、合并、评论、审阅)
  • 支持CI状态检查和分支保护验证
  • 包含详细的性能优化建议和故障排查指南
触发精准90/100

亮点

  • 触发短语覆盖全面(pull request、PR review、merge PR等)
  • description中明确列出了所有适用场景
  • 边界清晰,不易与其他Skill混淆
结构规范85/100

待提升项

  • 缺少When to Use章节 原报告严重程度:轻微

    文档结构完整但缺少显式的When to Use章节

    改进建议:建议添加When to Use章节以增强可读性

亮点

  • 步骤划分清晰(Step 1-10)
  • 包含多个端到端示例
  • frontmatter完整且规范
执行可靠88/100

待提升项

  • 缺少部分异常处理说明 原报告严重程度:轻微

    虽然覆盖了主要异常场景,但部分边缘情况处理说明可以更详细

    改进建议:建议补充更多边缘情况的处理建议

亮点

  • 工具来源明确(Harness MCP server)
  • 参数说明详细且准确
  • 不可逆操作(merge)提供了dry_run机制
  • 包含完整的故障排查章节
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 账号、密钥或授权

    使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。

    主文档提及 · 第 234 行
文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • app.harness.io

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

来源文档未说明。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。