mcpField
G
github

github

github.com/dicklesworthstone开发7391 次安装9 周前更新
代码仓库

关于 github

github 是一项使用 gh 命令行与 GitHub 仓库及服务交互的技能,适用于开发者和编码 Agent。它涵盖仓库、Issue、PR、Actions、发布、搜索及 API 等操作。

主要功能

  1. 01管理仓库、Issue 和 PR
  2. 02查看及操作 Actions 工作流
  3. 03创建和管理发布与 Gist
  4. 04搜索仓库、Issue、PR 和代码
  5. 05通过 gh api 调用 REST 与 GraphQL

适用场景

  1. 01从命令行创建或评审 PR
  2. 02跟踪 CI 运行并查看日志
  3. 03搜索代码或 GitHub 项目
  4. 04管理发布版本和附件

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/dicklesworthstone/agent_flywheel_clawdbot_skills_and_integrations --skill github

安装后在 Claude Code 中输入/github确认已加载。

详细介绍

GitHub CLI 技能

使用 gh CLI 与 GitHub 仓库和服务交互。

身份验证

检查身份验证状态:

gh auth status

登录:

gh auth login

刷新令牌:

gh auth refresh

仓库

克隆仓库:

gh repo clone owner/repo

创建新仓库:

gh repo create my-repo --public --source=. --push

复刻仓库:

gh repo fork owner/repo --clone

在浏览器中查看仓库:

gh repo view --web

列出你的仓库:

gh repo list

问题

列出问题:

gh issue list

创建问题:

gh issue create --title "Bug: Login fails" --body "Description here"

以交互方式创建问题:

gh issue create

查看问题:

gh issue view 123

关闭问题:

gh issue close 123

重新打开问题:

gh issue reopen 123

评论问题:

gh issue comment 123 --body "Working on this"

分配问题:

gh issue edit 123 --add-assignee @me

添加标签:

gh issue edit 123 --add-label "bug,priority:high"

拉取请求

列出 PR:

gh pr list

创建 PR:

gh pr create --title "Add feature" --body "Description"

从当前分支创建 PR:

gh pr create --fill

查看 PR:

gh pr view 45

在浏览器中查看 PR:

gh pr view 45 --web

在本地检出 PR:

gh pr checkout 45

评审 PR:

gh pr review 45 --approve
gh pr review 45 --request-changes --body "Please fix X"
gh pr review 45 --comment --body "Looks good but..."

合并 PR:

gh pr merge 45 --squash
gh pr merge 45 --merge
gh pr merge 45 --rebase

关闭 PR:

gh pr close 45

列出 PR 检查:

gh pr checks 45

查看 PR 差异:

gh pr diff 45

Actions(CI/CD)

列出工作流运行记录:

gh run list

查看运行详情:

gh run view 12345

监视正在进行的运行:

gh run watch 12345

查看运行日志:

gh run view 12345 --log

重新运行失败的作业:

gh run rerun 12345 --failed

列出工作流:

gh workflow list

手动运行工作流:

gh workflow run deploy.yml

使用输入运行:

gh workflow run deploy.yml -f environment=production

禁用/启用工作流:

gh workflow disable deploy.yml
gh workflow enable deploy.yml

版本发布

列出版本发布:

gh release list

创建版本发布:

gh release create v1.0.0 --title "Version 1.0" --notes "Release notes"

从标签创建:

gh release create v1.0.0 --generate-notes

上传资源:

gh release upload v1.0.0 ./dist/app.zip

下载资源:

gh release download v1.0.0

删除版本发布:

gh release delete v1.0.0

Gist

创建 Gist:

gh gist create file.txt --public

从标准输入创建:

echo "Hello" | gh gist create -

列出 Gist:

gh gist list

查看 Gist:

gh gist view GIST_ID

编辑 Gist:

gh gist edit GIST_ID

搜索

搜索仓库:

gh search repos "react hooks" --limit 10

搜索问题:

gh search issues "bug authentication" --repo owner/repo

搜索 PR:

gh search prs "fix memory leak" --state open

搜索代码:

gh search code "function handleAuth" --repo owner/repo

API

发起 API 请求:

gh api repos/owner/repo

POST 请求:

gh api repos/owner/repo/issues -f title="New issue" -f body="Description"

GraphQL 查询:

gh api graphql -f query='{ viewer { login } }'

对结果分页:

gh api repos/owner/repo/issues --paginate

标签

列出标签:

gh label list

创建标签:

gh label create "priority:high" --color FF0000 --description "High priority"

项目

列出项目:

gh project list

查看项目:

gh project view 1

SSH 密钥

列出 SSH 密钥:

gh ssh-key list

添加 SSH 密钥:

gh ssh-key add ~/.ssh/id_ed25519.pub --title "My laptop"

GPG 密钥

列出 GPG 密钥:

gh gpg-key list

添加 GPG 密钥:

gh gpg-key add key.gpg

密钥(用于 Actions)

列出密钥:

gh secret list

设置密钥:

gh secret set MY_SECRET

从文件设置:

gh secret set MY_SECRET < secret.txt

删除密钥:

gh secret delete MY_SECRET

变量(用于 Actions)

列出变量:

gh variable list

设置变量:

gh variable set MY_VAR --body "value"

扩展

列出已安装的扩展:

gh extension list

安装扩展:

gh extension install owner/gh-extension

浏览扩展:

gh extension browse

别名

创建别名:

gh alias set pv 'pr view'

列出别名:

gh alias list

配置

查看配置:

gh config list

设置默认编辑器:

gh config set editor vim

设置默认浏览器:

gh config set browser "open"

常见工作流

快速 PR 工作流:
# Create branch, commit, push, create PR
git checkout -b feature/my-feature
# ... make changes ...
git add . && git commit -m "Add feature"
git push -u origin feature/my-feature
gh pr create --fill
评审并合并:
gh pr checkout 45
# ... review code ...
gh pr review --approve
gh pr merge --squash --delete-branch
检查 CI 状态:
gh pr checks
gh run watch

评论

支持 Markdown