🐙 UNGH
无限访问 GitHub API
为什么选择 UNGH?
访问开源 GitHub 仓库的元数据应该快速、简单和直接。GitHub API 有速率限制,需要认证令牌来提高限制。即使使用 API 令牌,我们也需要为每次部署和本地开发共享或生成它,并且还要处理(增加的)速率限制和部署缓存。由于向后兼容的原因,GitHub REST API 也比较复杂,有(不必要的)更大的负载。
UNGH 提供了一个简化的、缓存的和匿名的层,使 GitHub API 使用更加愉快!
路线图
注意: 该项目仍在开发中,API 可能会发生变化。
API
/repos/{owner}/{name}
GitHub 仓库信息。
示例: https://ungh.cc/repos/unjs/h3
{
"repo": {
"id": 313641207,
"name": "h3",
"repo": "unjs/h3",
"description": "为高性能和可移植性而构建的最小 h(ttp) 框架 ⚡️",
"createdAt": "2020-11-17T14:15:44Z",
"updatedAt": "2022-11-05T21:38:43Z",
"pushedAt": "2022-11-06T06:48:23Z",
"stars": 1168,
"watchers": 1168,
"forks": 59,
"defaultBranch": "main"
}
}
/repos/{owner}/{name}/contributors
获取仓库贡献者。
示例: https://ungh.cc/repos/unjs/h3/contributors
{
"contributors": [
{
"id": 5158436,
"username": "pi0",
"contributions": 243
},
{
"id": 29139614,
"username": "renovate[bot]",
"contributions": 41
}
]
}
/repos/{owner}/{name}/files/{branch}
获取特定分支上的仓库文件树。
示例: https://ungh.cc/repos/unjs/h3/files/main
{
"meta": {
"sha": "501f0c6e623ea827d47691046f3c7319f5ac4651"
},
"files": [
{
"path": "README.md",
"mode": "100644",
"sha": "4c2b9ce4bccd6e046cd71be1a8c5e53a62778858",
"size": 5782
}
]
}
/repos/{owner}/{name}/files/{branch}/{...path}
从仓库获取文件内容。如果路径以 .md
结尾,将附加一个额外的 html
字段,其中包含渲染后的标记。
示例: https://ungh.cc/repos/unjs/h3/files/main/README.md
{
"meta": {
"url": "https://raw.githubusercontent.com/unjs/h3/main/README.md"
},
"file": {
"contents": "...",
"html": "..."
}
}
/repos/{owner}/{name}/readme
获取主分支上的仓库 readme 文件(不缓存)
示例: https://ungh.cc/repos/unjs/h3/readme
{
"html": "<p><a href=\"https://npmjs.com/package/h3\" rel=\"nofollow\"><img...",
"markdown": "[![npm downloads](https://img.shields.io...."
}
/repos/{owner}/{name}/releases
获取仓库发布版本。
示例: https://ungh.cc/repos/nuxt/framework/releases
{
"releases": [
{
"id": 82066265,
"tag": "v3.0.0-rc.13",
"author": "pi0",
"name": "v3.0.0-rc.13",
"draft": false,
"prerelease": false,
"createdAt": "2022-11-04T11:37:49Z",
"publishedAt": "2022-11-04T11:41:59Z",
"markdown": "....",
"html": "..."
}
]
}
/repos/{owner}/{name}/releases/latest
获取仓库最新发布版本。
示例: https://ungh.cc/repos/nuxt/framework/releases/latest
{
"release": {
"id": 82066265,
"tag": "v3.0.0-rc.13",
"author": "pi0",
"name": "v3.0.0-rc.13",
"draft": false,
"prerelease": false,
"createdAt": "2022-11-04T11:37:49Z",
"publishedAt": "2022-11-04T11:41:59Z",
"markdown": "....",
"html": "..."
}
}
/repos/{owner}/{name}/branches
获取仓库的所有分支
示例: https://ungh.cc/repos/unjs/ungh/branches
{
"branches": [
{
"name": "main",
"commit": {
"sha": "2eb6bff64caf0d18f082adde7606c4702513870b",
"url": "https://api.github.com/repos/unjs/ungh/commits/2eb6bff64caf0d18f082adde7606c4702513870b"
},
"protected": true
},
{
"name": "renovate/all-minor-patch",
"commit": {
"sha": "61140d05f66cd6b217f2475ad84e2d251ed7de05",
"url": "https://api.github.com/repos/unjs/ungh/commits/61140d05f66cd6b217f2475ad84e2d251ed7de05"
},
"protected": false
},
{
"name": "renovate/typescript-5.x",
"commit": {
"sha": "19b23fca2088722bbb41a7238bf8bd5272799718",
"url": "https://api.github.com/repos/unjs/ungh/commits/19b23fca2088722bbb41a7238bf8bd5272799718"
},
"protected": false
}
]
}
/orgs/{owner}
GitHub组织信息。
{
"org": {
"id": 80154025,
"name": "unjs",
"description": "统一的JavaScript工具"
}
}
/orgs/{owner}/repos
GitHub组织仓库概览。
示例: https://ungh.cc/orgs/unjs/repos
{
"repos": [
{
"id": 97751746,
"name": "redirect-ssl",
"repo": "unjs/redirect-ssl",
"description": "使用is-https强制执行https的Connect/Express中间件",
"createdAt": "2017-07-19T19:04:11Z",
"updatedAt": "2022-09-22T09:47:25Z",
"pushedAt": "2022-04-08T20:29:48Z",
"stars": 93,
"watchers": 93,
"forks": 14
}
]
}
/stars/{repos}
获取一个或多个仓库或组织的星标信息。
多个项目可以用,
或+
或
(空格)分隔。每个项目可以是{owner}/{org}
来指定一个仓库,或{owner}/*
来指定所有组织仓库。
示例: https://ungh.cc/stars/nuxt/nuxt.js+nuxt/framework
{
"totalStars": 51524,
"stars": {
"nuxt/nuxt.js": 41560,
"nuxt/framework": 9964
}
}
/users/{username}
通过用户名查找一个GitHub用户。
{
"user": {
"id": 5158436,
"name": "Pooya Parsa",
"twitter": null,
"username": "pi0"
}
}
/users/{username}/repos
获取用户仓库。
示例: https://ungh.cc/users/pi0/repos
{
"repos": [
{
"id": 674019467,
"name": "h3-on-edge",
"description": "⚡️ 由unjs/h3驱动的Edge workers流处理",
"repo": "pi0/h3-on-edge",
"stars": 51,
"pushedAt": "2024-01-07T16:54:46Z",
"createdAt": "2023-08-03T00:53:31Z",
"updatedAt": "2024-01-04T17:20:53Z",
"watchers": 51,
"forks": 0,
"defaultBranch": "main"
}
]
}
/users/find/{query}
通过电子邮件或其他查询查找一个GitHub用户。
示例: https://ungh.cc/users/find/pooya@pi0.io
{
"user": {
"id": 5158436,
"name": "Pooya Parsa",
"twitter": null,
"username": "pi0"
}
}
💻 开发
- 克隆此仓库
- 使用
corepack enable
启用Corepack(Node.js < 16.10 请使用npm i -g corepack
) - 使用
pnpm install
安装依赖 - 使用
pnpm dev
运行交互式测试
许可证
用💛制作
根据MIT许可证发布。