github-ops

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub Operations

GitHub运营

Manage GitHub repositories with a focus on community health, CI reliability, and contributor experience.
专注于社区健康、CI可靠性和贡献者体验的GitHub仓库管理。

When to Activate

触发场景

  • Triaging issues (classifying, labeling, responding, deduplicating)
  • Managing PRs (review status, CI checks, stale PRs, merge readiness)
  • Debugging CI/CD failures
  • Preparing releases and changelogs
  • Monitoring Dependabot and security alerts
  • Managing contributor experience on open-source projects
  • User says "check GitHub", "triage issues", "review PRs", "merge", "release", "CI is broken"
  • 分类处理Issue(归类、打标签、回复、去重)
  • 管理PR(审核状态、CI检查、过期PR、合并就绪状态)
  • 排查CI/CD故障
  • 准备版本发布和更新日志
  • 监控Dependabot和安全告警
  • 管理开源项目的贡献者体验
  • 用户提到「查看GitHub」、「分类处理Issue」、「审核PR」、「合并」、「发布」、「CI挂了」等内容时

Tool Requirements

工具要求

  • gh CLI for all GitHub API operations
  • Repository access configured via
    gh auth login
  • 所有GitHub API操作都需要使用gh CLI
  • 通过
    gh auth login
    配置仓库访问权限

Issue Triage

Issue分类处理

Classify each issue by type and priority:
Types: bug, feature-request, question, documentation, enhancement, duplicate, invalid, good-first-issue
Priority: critical (breaking/security), high (significant impact), medium (nice to have), low (cosmetic)
按类型和优先级对每个Issue进行归类:
类型: bug、feature-request、question、documentation、enhancement、duplicate、invalid、good-first-issue
优先级: critical(中断性/安全问题)、high(影响重大)、medium(值得优化)、low(展示类问题)

Triage Workflow

分类处理工作流

  1. Read the issue title, body, and comments
  2. Check if it duplicates an existing issue (search by keywords)
  3. Apply appropriate labels via
    gh issue edit --add-label
  4. For questions: draft and post a helpful response
  5. For bugs needing more info: ask for reproduction steps
  6. For good first issues: add
    good-first-issue
    label
  7. For duplicates: comment with link to original, add
    duplicate
    label
bash
undefined
  1. 阅读Issue标题、正文和评论
  2. 检查是否重复现有Issue(按关键词搜索)
  3. 通过
    gh issue edit --add-label
    添加合适的标签
  4. 针对问题类Issue:草拟并发布有帮助的回复
  5. 针对需要更多信息的bug:请求提供复现步骤
  6. 针对入门友好的Issue:添加
    good-first-issue
    标签
  7. 针对重复Issue:评论附上原Issue链接,添加
    duplicate
    标签
bash
undefined

Search for potential duplicates

Search for potential duplicates

gh issue list --search "keyword" --state all --limit 20
gh issue list --search "keyword" --state all --limit 20

Add labels

Add labels

gh issue edit <number> --add-label "bug,high-priority"
gh issue edit <number> --add-label "bug,high-priority"

Comment on issue

Comment on issue

gh issue comment <number> --body "Thanks for reporting. Could you share reproduction steps?"
undefined
gh issue comment <number> --body "Thanks for reporting. Could you share reproduction steps?"
undefined

PR Management

PR管理

Review Checklist

审核检查清单

  1. Check CI status:
    gh pr checks <number>
  2. Check if mergeable:
    gh pr view <number> --json mergeable
  3. Check age and last activity
  4. Flag PRs >5 days with no review
  5. For community PRs: ensure they have tests and follow conventions
  1. 检查CI状态:
    gh pr checks <number>
  2. 检查是否可合并:
    gh pr view <number> --json mergeable
  3. 检查PR创建时长和最近活动时间
  4. 标记超过5天未审核的PR
  5. 针对社区贡献PR:确保包含测试且符合开发规范

Stale Policy

过期规则

  • Issues with no activity in 14+ days: add
    stale
    label, comment asking for update
  • PRs with no activity in 7+ days: comment asking if still active
  • Auto-close stale issues after 30 days with no response (add
    closed-stale
    label)
bash
undefined
  • 超过14天无活动的Issue:添加
    stale
    标签,评论请求更新
  • 超过7天无活动的PR:评论询问是否仍在迭代
  • 超过30天无回复的过期Issue自动关闭(添加
    closed-stale
    标签)
bash
undefined

Find stale issues (no activity in 14+ days)

Find stale issues (no activity in 14+ days)

gh issue list --label "stale" --state open
gh issue list --label "stale" --state open

Find PRs with no recent activity

Find PRs with no recent activity

gh pr list --json number,title,updatedAt --jq '.[] | select(.updatedAt < "2026-03-01")'
undefined
gh pr list --json number,title,updatedAt --jq '.[] | select(.updatedAt < "2026-03-01")'
undefined

CI/CD Operations

CI/CD操作

When CI fails:
  1. Check the workflow run:
    gh run view <run-id> --log-failed
  2. Identify the failing step
  3. Check if it is a flaky test vs real failure
  4. For real failures: identify the root cause and suggest a fix
  5. For flaky tests: note the pattern for future investigation
bash
undefined
当CI运行失败时:
  1. 查看工作流运行记录:
    gh run view <run-id> --log-failed
  2. 定位失败步骤
  3. 区分是不稳定测试还是真实故障
  4. 针对真实故障:定位根因并给出修复建议
  5. 针对不稳定测试:记录问题模式留待后续排查
bash
undefined

List recent failed runs

List recent failed runs

gh run list --status failure --limit 10
gh run list --status failure --limit 10

View failed run logs

View failed run logs

gh run view <run-id> --log-failed
gh run view <run-id> --log-failed

Re-run a failed workflow

Re-run a failed workflow

gh run rerun <run-id> --failed
undefined
gh run rerun <run-id> --failed
undefined

Release Management

发布管理

When preparing a release:
  1. Check all CI is green on main
  2. Review unreleased changes:
    gh pr list --state merged --base main
  3. Generate changelog from PR titles
  4. Create release:
    gh release create
bash
undefined
准备版本发布时:
  1. 检查main分支所有CI运行正常
  2. 查看未发布的变更:
    gh pr list --state merged --base main
  3. 基于PR标题生成更新日志
  4. 创建版本发布:
    gh release create
bash
undefined

List merged PRs since last release

List merged PRs since last release

gh pr list --state merged --base main --search "merged:>2026-03-01"
gh pr list --state merged --base main --search "merged:>2026-03-01"

Create a release

Create a release

gh release create v1.2.0 --title "v1.2.0" --generate-notes
gh release create v1.2.0 --title "v1.2.0" --generate-notes

Create a pre-release

Create a pre-release

gh release create v1.3.0-rc1 --prerelease --title "v1.3.0 Release Candidate 1"
undefined
gh release create v1.3.0-rc1 --prerelease --title "v1.3.0 Release Candidate 1"
undefined

Security Monitoring

安全监控

bash
undefined
bash
undefined

Check Dependabot alerts

Check Dependabot alerts

gh api repos/{owner}/{repo}/dependabot/alerts --jq '.[].security_advisory.summary'
gh api repos/{owner}/{repo}/dependabot/alerts --jq '.[].security_advisory.summary'

Check secret scanning alerts

Check secret scanning alerts

gh api repos/{owner}/{repo}/secret-scanning/alerts --jq '.[].state'
gh api repos/{owner}/{repo}/secret-scanning/alerts --jq '.[].state'

Review and auto-merge safe dependency bumps

Review and auto-merge safe dependency bumps

gh pr list --label "dependencies" --json number,title

- Review and auto-merge safe dependency bumps
- Flag any critical/high severity alerts immediately
- Check for new Dependabot alerts weekly at minimum
gh pr list --label "dependencies" --json number,title

- 审核并自动合入安全的依赖升级PR
- 立即标记所有严重/高优先级安全告警
- 至少每周检查一次新的Dependabot告警

Quality Gate

质量门禁

Before completing any GitHub operations task:
  • all issues triaged have appropriate labels
  • no PRs older than 7 days without a review or comment
  • CI failures have been investigated (not just re-run)
  • releases include accurate changelogs
  • security alerts are acknowledged and tracked
完成任何GitHub运营任务前需确认:
  • 所有已处理的Issue都添加了合适的标签
  • 没有超过7天未审核或未回复的PR
  • CI故障已经过排查(而非仅重新运行)
  • 版本发布包含准确的更新日志
  • 安全告警已被确认并跟进