Run3 github api paginated search
Fetch data from GitHub's Search API using the GitHub CLI (gh) while correctly handling pagination and merging results. Use this when you need to retrieve more than 100 items or ensure full dataset coverage for a specific period.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill run3_github_api_paginated_searchAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
1.2 KB, 247 tokens by cl100k_base, as published. Nobody here has run it
To fetch all items from a GitHub search query across multiple pages:
- Use the
gh apicommand with the--paginateflag. - Target the
search/issuesendpoint (which covers both Issues and Pull Requests). - Append your query using the
-f q="..."parameter. - Use
jqwith the-s(slurp) flag to combine the separate JSON objects returned for each page into a single array of items.
Example for fetching all PRs created in a specific month:
gh api --paginate "search/issues" -f q="repo:cli/cli is:pr created:2024-12-01..2024-12-31" | jq -s 'map(.items) | add' > prs.json
Key considerations:
- Pagination: Without
-s 'map(.items) | add',jqwill only process the first page's object or encounter errors when trying to treat multiple JSON objects as a single stream. - Separate Queries: Use distinct queries for "created" and "closed" events to ensure accuracy, as an item created in one month might be closed in another.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.