4k Dimillian

github Skill

使用 `gh` CLI 与 GitHub 交互。用 `gh issue`、`gh pr`、`gh run` 和 `gh api` 处理 issue、PR、CI 运行和高级查询。当用户询问 GitHub issue、PR、工作流,或想从命令行操作 GitHub 仓库时使用——包括检查 CI 状态、创建 PR、列出 issue 或查询 GitHub API 等任务。

安装方式:把技能目录放入 ~/.claude/skills/(Claude Code)或在 claude.ai 设置中启用;也可复制右侧安装命令一键添加。

查看源码

技能指令原文(SKILL.md)

GitHub Skill

Use the gh CLI to interact with GitHub. Always specify --repo owner/repo when not in a git directory, or use URLs directly.

Pull Requests

Check CI status on a PR:

gh pr checks 55 --repo owner/repo

List recent workflow runs:

gh run list --repo owner/repo --limit 10

View a run and see which steps failed:

gh run view <run-id> --repo owner/repo

View logs for failed steps only:

gh run view <run-id> --repo owner/repo --log-failed

Debugging a CI Failure

Follow this sequence to investigate a failing CI run:

  1. Check PR status — identify which checks are failing:
   gh pr checks 55 --repo owner/repo
  1. List recent runs — find the relevant run ID:
   gh run list --repo owner/repo --limit 10
  1. View the failed run — see which jobs and steps failed:
   gh run view <run-id> --repo owner/repo
  1. Fetch failure logs — get the detailed output for failed steps:
   gh run view <run-id> --repo owner/repo --log-failed

API for Advanced Queries

The gh api command is useful for accessing data not available through other subcommands.

Get PR with specific fields:

gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login'

JSON Output

Most commands support --json for structured output. You can use --jq to filter:

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

配合站内内容