github-search-api
Fetch repository metrics, issues, and pull requests over a specific date range using the GitHub Search API.
- License 许可
- MIT
- 最近更新
- 2026-10-02
- Stars
- ★ 93
- Forks
- 8
01 前言 Front Matter
- name
- github-search-api
- description
- Fetch repository metrics, issues, and pull requests over a specific date range using the GitHub Search API.
03 SKILL.md 正文
GitHub Search API
The GitHub Search API is a powerful tool to extract data about issues and pull requests, allowing for filters based on creation date, closed date, repository, and more.
Installation / Setup
No special installation is required beyond curl or a standard HTTP client like requests in Python. If a GitHub Personal Access Token (PAT) is available, use it via the Authorization: Bearer <TOKEN> header to increase rate limits.
Key Concepts
- The API endpoint for issues/PRs is
https://api.github.com/search/issues. - The
qparameter takes a Lucene-like query. For example:repo:cli/cli is:pr created:2024-12-01..2024-12-31. - Pagination is handled via
per_page(max 100) andpageparameters. - Pull requests are technically returned as issues in the search API. You differentiate them by checking the presence of a
pull_requestkey in the item dictionary.
Code Example (Python)
import requests
def fetch_items(query):
url = "https://api.github.com/search/issues"
headers = {"Accept": "application/vnd.github.v3+json"}
items = []
page = 1
while True:
params = {"q": query, "per_page": 100, "page": page}
response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
data = response.json()
items.extend(data.get("items", []))
if len(items) >= data.get("total_count", 0) or not data.get("items"):
break
page += 1
return items
# Example usage:
# prs = fetch_items("repo:cli/cli is:pr created:2024-12-01..2024-12-31")
# print(f"Fetched {len(prs)} PRs.")
Best Practices
- Always check
total_countto ensure you are fetching all results. - Implement rate limit handling if fetching large datasets or running frequently.
- When searching for labels with specific strings, it is often more reliable to fetch the items and filter them in memory using string matching on the label names.
04 同仓库更多 Skills
object_counter
Count occurrences of an object in the image using computer vision algorithm.
travel-planning-workflow
Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.
bundled-dataset-search-tool
invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.
glm-output
Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final /root/metrics.json.
glm-calibration
Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.
glm-basics
A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.