← スキル一覧に戻る

github
by cuba6112
⭐ 0🍴 0📅 2025年12月26日
SKILL.md
name: github description: Automation of GitHub tasks using the gh CLI and REST API. Includes pagination strategies, payload construction, and rate limit management. Triggers: github, gh-cli, github-api, rate-limit, pagination, pull-request.
GitHub API and CLI
Overview
Managing GitHub at scale requires moving beyond the web UI to the gh CLI and the REST API. This skill focuses on high-efficiency operations like bulk querying with pagination and managing API quotas.
When to Use
- Bulk Operations: Fetching all issues or PRs across a large repository.
- CI/CD Automation: Creating issues or comments programmatically.
- Compliance/Auditing: Checking rate limits or repository permissions.
Decision Tree
- Is it a standard task (e.g., creating a PR, checking issue status)?
- YES: Use
ghCLI commands.
- YES: Use
- Do you need custom data fields or specific API endpoints?
- YES: Use
gh apiwith--jq.
- YES: Use
- Are there more than 100 results?
- YES: Use
--paginateand--slurp.
- YES: Use
Workflows
1. Bulk Querying with Pagination
- Construct a
gh apicall to a list endpoint (e.g.,repos/{owner}/{repo}/issues). - Add the
--paginateflag to ensure all pages are fetched. - Use
--slurpto group results and--jqto filter for specific fields like.[] | {title, user: .user.login}.
2. Automated Issue Creation
- Run
gh auth loginto establish credentials. - Define the issue payload using
-f title="Bug Report"and-f body=@issue_template.md. - Execute the POST request to
repos/{owner}/{repo}/issuesusing theghCLI.
3. Handling API Rate Limits
- Query the rate limit status using
gh api rate_limit. - Inspect the
X-RateLimit-Resetheader in response objects to determine when the quota refreshes. - Implement exponential backoff in scripts when a 403 Forbidden (rate limited) status is encountered.
Non-Obvious Insights
- Magic Type Conversion: In the
ghCLI, the-F/--fieldflag automatically converts literals liketrue,false,null, and integers to their JSON types. - User-Agent Requirement: All direct REST API requests MUST include a valid
User-Agentheader, or GitHub will reject them. - Path Placeholders: Using
{owner},{repo}, and{branch}ingh apiarguments automatically pulls values from the local repository context.
Evidence
- "In --paginate mode, all pages of results will sequentially be requested until there are no more pages..." - gh CLI Docs
- "All API requests must include a valid User-Agent header... Requests with no User-Agent header will be rejected." - GitHub Docs
- "Placeholder values {owner}, {repo}, and {branch} in the endpoint argument will get replaced with values from the repository..." - gh CLI Docs
Scripts
scripts/github_tool.py: Python wrapper for rate limit checking and pagination.scripts/github_tool.js: Node.js script using theghCLI for bulk querying.
Dependencies
gh(GitHub CLI)jq(Recommended for processing JSON outputs)
References
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です