Skill站外收录 @skilllib/skill-2117939930272410185
gh-cli
通过命令行实现对 GitHub仓库、代码评审、议题及持续集成任务的高效管理,支持快速创建和审查 pull request、查询与追踪问题、查看并重跑工作流运行,适用于自动化协作和远程开发场景。
开发运维 AI 技能
Skills.MD
# GitHub CLI Quick Reference
The `gh` CLI is GitHub's official command-line tool. This is a quick reference for
common workflows—for comprehensive docs, see https://cli.github.com/manual
## Getting Help
```bash
gh --help # List all commands
gh <command> --help # Help for specific command
gh auth status # Check authentication
```
## Discovery Patterns
```bash
gh <command> --web # Open in browser
gh <command> --json FIELDS # JSON output for scripting
gh <command> <subcommand> -h # Quick help for any command
gh <command> list --limit N # Limit results to avoid large output (default: 20-30)
```
Use tab completion to explore available commands and flags.
**Important:** Always use `--limit` when querying lists to avoid overwhelming output,
especially with `pr list`, `issue list`, `run list`, etc.
## Common Workflows
### PR Workflow
```bash
# Create PR
gh pr create --fill # Use commit messages for title/body
gh pr create --web # Open browser to create PR
# View and checkout
gh pr list # List PRs
gh pr view [NUMBER] # View PR details
gh pr checkout NUMBER # Checkout PR locally
# Review
gh pr review NUMBER --approve
gh pr review NUMBER --comment -b "feedback"
# Merge
gh pr merge --squash --delete-branch
```
### Review Workflow
```bash
# Find PRs needing your review
gh pr list --search "review-requested:@me"
# Review process
gh pr checkout NUMBER
# ... test locally ...
gh pr review NUMBER --approve
```
### CI/CD Debugging
```bash
# Check recent runs
gh run list --limit 5
gh run list --status failure
# View logs
gh run view RUN_ID --log-failed
# Rerun after fix
gh run rerun RUN_ID --failed
```
### Issue Triage
```bash
gh issue list
gh issue list --assignee @me
gh issue create --title "Title" --body "Description"
gh issue view NUMBER
gh issue comment NUMBER -b "Comment"
gh issue close NUMBER
```
## Core Commands Quick Reference
### Pull Requests
```bash
gh pr list [--state open|closed|merged] [--author @me]
gh pr create [--draft] [--title "..."] [--body "..."]
gh pr view [NUMBER] [--web]
gh pr checkout NUMBER
gh pr diff [NUMBER]
gh pr merge [NUMBER] [--squash|--merge|--rebase]
```
### Issues
```bash
gh issue list [--assignee @me] [--label "bug"]
gh issue create [--title "..."] [--body "..."]
gh issue view NUMBER [--web]
gh issue close NUMBER
```
### Workflows & Runs
```bash
gh run list [--workflow "CI"] [--status failure]
gh run view RUN_ID [--log] [--log-failed]
gh run watch RUN_ID
gh workflow run WORKFLOW_FILE [--ref branch]
```
### Repositories
```bash
gh repo clone OWNER/REPO
gh repo view [--web]
gh repo fork OWNER/REPO
gh repo create NAME [--public|--private]
```
## Power User Tips
### JSON Output
```bash
# Get structured data
gh pr list --json number,title,author
# Filter with jq
gh pr list --json number,title | jq '.[] | select(.number > 100)'
```
### API Access
```bash
# Direct API calls
gh api repos/OWNER/REPO
gh api repos/OWNER/REPO/pulls -f title="PR Title" -f head=branch -f base=main
# GraphQL
gh api graphql -f query='{ viewer { login } }'
```
### Aliases
```bash
gh alias set pv 'pr view'
gh alias set co 'pr checkout'
gh alias list
```
### Environment Variables
- `GH_TOKEN`: Authentication token
- `GH_REPO`: Default repository (OWNER/REPO format)
- `GH_EDITOR`: Preferred editor for interactive commands
- `GH_PAGER`: Pager for output (e.g., `less`)
## Finding Your Work
```bash
gh pr list --author @me
gh issue list --assignee @me
gh search prs "author:username is:open"
gh search issues "assignee:username is:open"
```
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「gh-cli」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次