gitlink-cli/skills/gitlink-pr/references/gitlink-pr-view.md

43 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# pr +view
> **前置条件:** 先阅读 [`../../gitlink-shared/SKILL.md`](../../gitlink-shared/SKILL.md) 了解认证、全局参数和安全规则。
查看 Pull Request 详情。
## 命令
```bash
# 查看 PR 详情
gitlink-cli pr +view --id 3
# 简写
gitlink-cli pr +view -i 3
# JSON 格式输出
gitlink-cli pr +view -i 3 --format json
```
## 参数
| 参数 | 必填 | 说明 |
|------|------|------|
| `--id` / `-i` | 是 | PR 序号(`pull_request_number`,即网页 URL `/pulls/N` 中的数字,从 `pr +list` 获取) |
## API
```
GET /{owner}/{repo}/pulls/{number}
```
## 注意事项
- `--id` 使用的是 `pull_request_number`(网页 URL 中的序号),可从 `pr +list` 返回的 `pull_request_number` 字段获取
- 返回内容包含 PR 标题、描述、状态、源/目标分支、作者等详细信息
- PR 状态字段 `pull_request_status``0` = open, `1` = merged, `2` = closed
- 建议在执行 `pr +merge``pr +close` 前先用 `pr +view` 确认 PR 当前状态
## References
- [gitlink-shared SKILL.md](../../gitlink-shared/SKILL.md) -- 认证与全局参数
- [gitlink-pr SKILL.md](../SKILL.md) -- PR 操作总览