Skip to content

Commit 366a7e2

Browse files
author
maekblack
committed
feat: GitHub API 查询工具
1 parent 178a3a5 commit 366a7e2

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed
10.3 KB
Binary file not shown.

tools/tool_github_search/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# GitHub API 查询工具
2+
3+
查询 GitHub 仓库信息、Issues、Pull Requests、Releases 和贡献者数据。
4+
5+
## 功能特点
6+
7+
- 仓库基本信息查询
8+
- Issues/PRs 查询
9+
- Releases 查询
10+
- 贡献者查询
11+
- 支持 Token 认证
12+
13+
## 参数说明
14+
15+
**输入参数**: owner, repo, query_type, state, per_page
16+
```python
17+
def query_github_repository(
18+
owner: str,
19+
repo: str,
20+
query_type: str,
21+
state: str,
22+
token: Optional[str] = None,
23+
per_page: int = 10,
24+
page: int = 1
25+
) -> Dict[str, Any]:
26+
"""查询 GitHub 仓库信息
27+
28+
Args:
29+
owner: 仓库所有者(用户名或组织名)
30+
repo: 仓库名称
31+
token: GitHub Personal Access Token(可选,用于提高速率限制)
32+
query_type: 查询类型,可选 "info"/"issues"/"pulls"/"releases"/"contributors"
33+
state: 状态过滤,可选 "open"/"closed"/"all",默认 "open"
34+
per_page: 每页结果数,默认 10
35+
page: 页码,默认 1
36+
37+
Returns:
38+
Dict[str, Any]: 包含查询结果的字典,结构如下:
39+
- success (bool): 是否成功
40+
- data (Dict|None): 查询数据,包含:
41+
- type (str): 查询类型
42+
- repository (str): 仓库全名
43+
- info (Dict|None): 仓库基本信息
44+
- items (List|None): 结果列表(issues/prs/releases 等)
45+
- total_count (int): 总数
46+
- message (str): 结果消息
47+
48+
Raises:
49+
无异常抛出,所有错误在返回值中处理
50+
51+
Examples:
52+
>>> result = query_github_repository("1Panel-dev", "MaxKB", query_type="info")
53+
>>> if result["success"]:
54+
... print(f"Stars: {result['data']['info']['stargazers_count']}")
55+
"""
56+
```
57+
**启动参数**: token (可选)
58+
59+
## 使用说明
60+
61+
无需 Token 即可查询公开仓库,提供 Token 可提高速率限制。

tools/tool_github_search/data.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: GitHub API 查询
2+
tags:
3+
- 联网搜索
4+
title: GitHub API 查询工具
5+
description: 查询 GitHub 仓库信息、Issues、Pull Requests、Releases、贡献者等数据,支持仓库基本信息统计和动态查询

tools/tool_github_search/logo.png

497 Bytes
Loading

0 commit comments

Comments
 (0)