Skip to content

Commit 14b3e9f

Browse files
committed
docs: Add project documentation and metadata files
This commit adds several important documentation and metadata files to improve project transparency, contribution guidelines, and user information: - Created CHANGELOG.md with initial release details - Added CODE_OF_CONDUCT.md to establish community standards - Created CONTRIBUTING.md with guidelines for bug reports, enhancements, and development - Updated README files (English and Chinese) with comprehensive project information - Added SECURITY.md to outline vulnerability reporting process - Enhanced index.ts and types.ts with additional metadata and usage information
1 parent c1af82b commit 14b3e9f

File tree

8 files changed

+335
-9
lines changed

8 files changed

+335
-9
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0] - 2024-02-14
9+
10+
### Added
11+
12+
- Initial release
13+
- Basic GitHub achievements fetching functionality
14+
- Cache support
15+
- CORS support
16+
- Basic error handling
17+
- Documentation

CODE_OF_CONDUCT.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone.
7+
8+
## Our Standards
9+
10+
Examples of behavior that contributes to a positive environment:
11+
12+
- Using welcoming and inclusive language
13+
- Being respectful of differing viewpoints and experiences
14+
- Gracefully accepting constructive criticism
15+
- Focusing on what is best for the community
16+
- Showing empathy towards other community members
17+
18+
Examples of unacceptable behavior:
19+
20+
- The use of sexualized language or imagery
21+
- Trolling, insulting/derogatory comments, and personal or political attacks
22+
- Public or private harassment
23+
- Publishing others' private information without explicit permission
24+
- Other conduct which could reasonably be considered inappropriate
25+
26+
## Enforcement Responsibilities
27+
28+
Project maintainers are responsible for clarifying and enforcing our standards of
29+
acceptable behavior and will take appropriate and fair corrective action in
30+
response to any behavior that they deem inappropriate.
31+
32+
## Scope
33+
34+
This Code of Conduct applies within all community spaces, and also applies when
35+
an individual is officially representing the community in public spaces.
36+
37+
## Enforcement
38+
39+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
40+
reported to the project maintainers responsible for enforcement at
41+
[INSERT CONTACT METHOD].
42+
43+
## Attribution
44+
45+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org).

CONTRIBUTING.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Contributing to GitHub Achievements API
2+
3+
First off, thanks for taking the time to contribute! 🎉
4+
5+
## How Can I Contribute?
6+
7+
### Reporting Bugs
8+
9+
Before creating bug reports, please check the issue list as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
10+
11+
- Use a clear and descriptive title
12+
- Describe the exact steps which reproduce the problem
13+
- Provide specific examples to demonstrate the steps
14+
- Describe the behavior you observed after following the steps
15+
- Explain which behavior you expected to see instead and why
16+
- Include screenshots if possible
17+
18+
### Suggesting Enhancements
19+
20+
Enhancement suggestions are tracked as GitHub issues. When you are creating an enhancement suggestion, please include:
21+
22+
- Use a clear and descriptive title
23+
- Provide a step-by-step description of the suggested enhancement
24+
- Provide specific examples to demonstrate the steps
25+
- Describe the current behavior and explain which behavior you expected to see instead
26+
- Explain why this enhancement would be useful
27+
28+
### Pull Requests
29+
30+
- Fill in the required template
31+
- Follow the TypeScript coding style
32+
- Include appropriate test cases
33+
- Update the documentation accordingly
34+
35+
## Development Process
36+
37+
1. Fork the repo and create your branch from `main`
38+
2. Run `pnpm install` to install dependencies
39+
3. Make your changes
40+
4. Run `pnpm test` to ensure tests pass
41+
5. Push your changes and create a pull request
42+
43+
## Style Guidelines
44+
45+
- Use TypeScript
46+
- Follow the existing code style
47+
- Write meaningful commit messages
48+
- Keep code clean and well-documented
49+
50+
## Additional Notes
51+
52+
- Please don't include unrelated changes in your pull request
53+
- Feel free to ask for help if you're unsure about something

README.md

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
# GitHub Achievements API
22

3+
<p align="center">
4+
<img src="https://github.githubassets.com/images/modules/profile/achievements/pull-shark-default.png" width="100" height="100" alt="Pull Shark Achievement" />
5+
</p>
6+
37
[![License](https://img.shields.io/github/license/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/blob/main/LICENSE)
48
[![GitHub package.json version](https://img.shields.io/github/package-json/v/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/blob/main/package.json)
59
[![GitHub last commit](https://img.shields.io/github/last-commit/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/commits)
610
[![Test Status](https://img.shields.io/github/actions/workflow/status/wangrunlin/github-achievements-api/test.yml?label=test)](https://github.com/wangrunlin/github-achievements-api/actions)
11+
[![Node Version](https://img.shields.io/node/v/github-achievements-api)](https://nodejs.org)
12+
[![TypeScript](https://img.shields.io/badge/TypeScript-5.5.2-blue.svg)](https://www.typescriptlang.org/)
13+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
14+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)
15+
[![GitHub stars](https://img.shields.io/github/stars/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/stargazers)
16+
[![GitHub forks](https://img.shields.io/github/forks/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/network)
17+
[![GitHub issues](https://img.shields.io/github/issues/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/issues)
18+
[![Visitors](https://visitor-badge.laobi.icu/badge?page_id=wangrunlin.github-achievements-api)](https://github.com/wangrunlin/github-achievements-api)
19+
[![Ko-fi](https://img.shields.io/badge/Ko--fi-Support-orange)](https://ko-fi.com/wangrunlin)
720

821
English | [简体中文](README_zh.md)
922

@@ -65,6 +78,56 @@ GET https://<your-worker>.workers.dev/wangrunlin
6578
}
6679
```
6780

81+
## API Documentation
82+
83+
### Rate Limiting
84+
85+
This API inherits GitHub's rate limiting. Please be mindful of GitHub's rate limits when making requests.
86+
87+
### Caching
88+
89+
- Responses are cached for 1 hour to improve performance
90+
- Cache is automatically invalidated when new achievements are earned
91+
- Cache can be bypassed by adding `?nocache=true` to the request
92+
93+
### Error Responses
94+
95+
| Status Code | Description |
96+
| ----------- | --------------------- |
97+
| 404 | User not found |
98+
| 429 | Rate limit exceeded |
99+
| 500 | Internal server error |
100+
101+
Example error response:
102+
103+
```json
104+
{
105+
"error": "Failed to fetch GitHub achievements: Not Found"
106+
}
107+
```
108+
109+
## Roadmap
110+
111+
- [ ] Add support for achievement descriptions
112+
- [ ] Add support for achievement dates
113+
- [ ] Add support for achievement images
114+
- [ ] Add API key authentication
115+
- [ ] Add more detailed statistics
116+
- [ ] Add support for organization achievements
117+
- [ ] Add webhook notifications for new achievements
118+
119+
## Sponsors
120+
121+
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.
122+
123+
[![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/wangrunlin)
124+
125+
[Other sponsorship options](https://alin.run/sponsor)
126+
127+
## Who's using GitHub Achievements API?
128+
129+
Are you using this API? [Let us know](https://github.com/wangrunlin/github-achievements-api/issues/new) and we'll add your logo here!
130+
68131
## Local Development
69132

70133
### Prerequisites
@@ -129,7 +192,32 @@ Issues and Pull Requests are welcome!
129192

130193
[Leo Wang](https://github.com/wangrunlin)
131194

195+
## Available Achievements
196+
197+
Here are all the achievements currently available on GitHub:
198+
199+
[View more details about GitHub Achievements](https://github.com/drknzz/GitHub-Achievements)
200+
201+
| Achievement | Name | Description | Max Tiers |
202+
| -------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------------------------------------------- | --------- |
203+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/starstruck-default.png" width="60px"> | Starstruck | Created a repository that has 16 stars | 4 |
204+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/quickdraw-default.png" width="60px"> | Quickdraw | Closed an issue/PR within 5 minutes of opening | 1 |
205+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/pair-extraordinaire-default.png" width="60px"> | Pair Extraordinaire | Coauthored in merged pull request | 3 |
206+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/pull-shark-default.png" width="60px"> | Pull Shark | Opened a pull request that has been merged | 3 |
207+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/galaxy-brain-default.png" width="60px"> | Galaxy Brain | Answered a discussion with an accepted answer | 4 |
208+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/yolo-default.png" width="60px"> | YOLO | Merged a pull request without code review | 1 |
209+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/arctic-code-vault-contributor-default.png" width="60px"> | Arctic Code Vault | Contributed code to repositories in the 2020 GitHub Archive Program | 1 |
210+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/public-sponsor-default.png" width="60px"> | Public Sponsor | Sponsored an open source contributor through GitHub Sponsors | 1 |
211+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/mars-2020-contributor-default.png" width="60px"> | Mars 2020 Contributor | Contributed code to repositories used in the Mars 2020 Mission | 1 |
212+
132213
## Acknowledgments
133214

134-
- GitHub Achievement System
135-
- Cloudflare Workers Platform
215+
Thanks to these awesome projects and resources:
216+
217+
- [GitHub](https://github.com) - For providing the achievement system
218+
- [Cloudflare Workers](https://workers.cloudflare.com) - For the serverless platform
219+
- [GitHub Achievements List](https://github.com/drknzz/GitHub-Achievements) - For the comprehensive achievements documentation
220+
- [TypeScript](https://www.typescriptlang.org) - For the typed JavaScript
221+
- [Vitest](https://vitest.dev) - For the testing framework
222+
- [Wrangler](https://developers.cloudflare.com/workers/wrangler/) - For the development & deployment tool
223+
- [pnpm](https://pnpm.io) - For the fast package manager

README_zh.md

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
# GitHub Achievements API
22

3+
<p align="center">
4+
<img src="https://github.githubassets.com/images/modules/profile/achievements/pull-shark-default.png" width="100" height="100" alt="Pull Shark 成就" />
5+
</p>
6+
37
[![License](https://img.shields.io/github/license/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/blob/main/LICENSE)
48
[![GitHub package.json version](https://img.shields.io/github/package-json/v/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/blob/main/package.json)
59
[![GitHub last commit](https://img.shields.io/github/last-commit/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/commits)
610
[![Test Status](https://img.shields.io/github/actions/workflow/status/wangrunlin/github-achievements-api/test.yml?label=test)](https://github.com/wangrunlin/github-achievements-api/actions)
11+
[![Node Version](https://img.shields.io/node/v/github-achievements-api)](https://nodejs.org)
12+
[![TypeScript](https://img.shields.io/badge/TypeScript-5.5.2-blue.svg)](https://www.typescriptlang.org/)
13+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
14+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)
15+
[![GitHub stars](https://img.shields.io/github/stars/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/stargazers)
16+
[![GitHub forks](https://img.shields.io/github/forks/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/network)
17+
[![GitHub issues](https://img.shields.io/github/issues/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/issues)
18+
[![Visitors](https://visitor-badge.laobi.icu/badge?page_id=wangrunlin.github-achievements-api)](https://github.com/wangrunlin/github-achievements-api)
19+
[![Ko-fi](https://img.shields.io/badge/Ko--fi-Support-orange)](https://ko-fi.com/wangrunlin)
720

821
[English](README.md) | 简体中文
922

@@ -65,6 +78,56 @@ GET https://<your-worker>.workers.dev/wangrunlin
6578
}
6679
```
6780

81+
## API 文档
82+
83+
### 速率限制
84+
85+
本 API 继承了 GitHub 的速率限制。请注意在发送请求时遵守 GitHub 的速率限制规则。
86+
87+
### 缓存机制
88+
89+
- 响应结果缓存时间为 1 小时,以提高性能
90+
- 当获得新成就时,缓存会自动失效
91+
- 可以通过在请求中添加 `?nocache=true` 来绕过缓存
92+
93+
### 错误响应
94+
95+
| 状态码 | 描述 |
96+
| ------ | -------------- |
97+
| 404 | 用户未找到 |
98+
| 429 | 超出速率限制 |
99+
| 500 | 内部服务器错误 |
100+
101+
错误响应示例:
102+
103+
```json
104+
{
105+
"error": "Failed to fetch GitHub achievements: Not Found"
106+
}
107+
```
108+
109+
## 项目路线图
110+
111+
- [ ] 添加成就描述支持
112+
- [ ] 添加成就获得日期支持
113+
- [ ] 添加成就图片支持
114+
- [ ] 添加 API 密钥认证
115+
- [ ] 添加更详细的统计信息
116+
- [ ] 添加组织成就支持
117+
- [ ] 添加新成就获得时的 webhook 通知
118+
119+
## 赞助商
120+
121+
成为赞助商来支持这个项目。您的 logo 将会出现在这里并链接到您的网站。
122+
123+
[![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/wangrunlin)
124+
125+
[其他赞助方式](https://alin.run/sponsor)
126+
127+
## 谁在使用 GitHub Achievements API?
128+
129+
您正在使用这个 API 吗?[告诉我们](https://github.com/wangrunlin/github-achievements-api/issues/new),我们会在这里添加您的 logo!
130+
68131
## 本地开发
69132

70133
### 前置要求
@@ -129,7 +192,32 @@ MIT
129192

130193
[Leo Wang](https://github.com/wangrunlin)
131194

195+
## 可获得的成就
196+
197+
以下是目前 GitHub 上可获得的所有成就:
198+
199+
[查看更多 GitHub 成就相关信息](https://github.com/drknzz/GitHub-Achievements)
200+
201+
| 成就图标 | 名称 | 描述 | 最高等级 |
202+
| -------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | --------------------------------------- | -------- |
203+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/starstruck-default.png" width="60px"> | Starstruck | 创建的仓库获得 16 个星标 | 4 |
204+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/quickdraw-default.png" width="60px"> | Quickdraw | 在开启后 5 分钟内关闭了 Issue 或 PR | 1 |
205+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/pair-extraordinaire-default.png" width="60px"> | Pair Extraordinaire | 在已合并的 PR 中作为合作者 | 3 |
206+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/pull-shark-default.png" width="60px"> | Pull Shark | 创建的 PR 被合并 | 3 |
207+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/galaxy-brain-default.png" width="60px"> | Galaxy Brain | 在讨论中的回答被采纳 | 4 |
208+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/yolo-default.png" width="60px"> | YOLO | 在没有代码审查的情况下合并 PR | 1 |
209+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/arctic-code-vault-contributor-default.png" width="60px"> | Arctic Code Vault | 为 2020 GitHub 存档计划中的仓库贡献代码 | 1 |
210+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/public-sponsor-default.png" width="60px"> | Public Sponsor | 通过 GitHub Sponsors 赞助开源贡献者 | 1 |
211+
| <img src="https://github.githubassets.com/images/modules/profile/achievements/mars-2020-contributor-default.png" width="60px"> | Mars 2020 Contributor | 为火星 2020 任务中使用的仓库贡献代码 | 1 |
212+
132213
## 致谢
133214

134-
- GitHub 提供的成就系统
135-
- Cloudflare Workers 平台
215+
感谢这些优秀的项目和资源:
216+
217+
- [GitHub](https://github.com) - 提供成就系统
218+
- [Cloudflare Workers](https://workers.cloudflare.com) - 提供无服务器平台
219+
- [GitHub Achievements List](https://github.com/drknzz/GitHub-Achievements) - 提供完整的成就文档
220+
- [TypeScript](https://www.typescriptlang.org) - 提供类型化的 JavaScript
221+
- [Vitest](https://vitest.dev) - 提供测试框架
222+
- [Wrangler](https://developers.cloudflare.com/workers/wrangler/) - 提供开发和部署工具
223+
- [pnpm](https://pnpm.io) - 提供快速的包管理器

SECURITY.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 0.1.x | :white_check_mark: |
8+
9+
## Reporting a Vulnerability
10+
11+
If you discover a security vulnerability within GitHub Achievements API, please send an email to [alin.runlin@gmail.com](mailto:alin.runlin@gmail.com). All security vulnerabilities will be promptly addressed.
12+
13+
Please do not report security vulnerabilities through public GitHub issues.
14+
15+
## Security Update Process
16+
17+
1. The security report will be reviewed
18+
2. A fix will be prepared
19+
3. A security advisory will be published
20+
4. The fix will be released
21+
22+
Thank you for helping keep GitHub Achievements API secure!

0 commit comments

Comments
 (0)