ClawSkills logoClawSkills

Github

使用 `gh` CLI 与 GitHub 交互。使用 `gh issue`、`gh pr`、`gh run` 和 `gh api` 处理 issue、PR、CI 运行和高级查询。

介绍

# GitHub Skill

使用 `gh` CLI 与 GitHub 交互。当不在 git 目录中时,请始终指定 `--repo owner/repo`,或直接使用 URL。

## Pull Requests

检查 PR 的 CI 状态: ```bash gh pr checks 55 --repo owner/repo ```

列出最近的工作流运行: ```bash gh run list --repo owner/repo --limit 10 ```

查看运行并查看哪些步骤失败: ```bash gh run view <run-id> --repo owner/repo ```

仅查看失败步骤的日志: ```bash gh run view <run-id> --repo owner/repo --log-failed ```

## 用于高级查询的 API

`gh api` 命令对于访问其他子命令未提供的数据非常有用。

获取具有特定字段的 PR: ```bash gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login' ```

## JSON 输出

大多数命令支持 `--json` 以进行结构化输出。您可以使用 `--jq` 进行筛选:

```bash gh issue list --repo owner/repo --json number,title --jq '.[] | "\(.number): \(.title)"' ```

更多产品