Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
root = true

[*]
indent_style = tab
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
35 changes: 12 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,34 @@
name: Test

on:
push:
branches: [main]
branches:
- main
pull_request:
branches: [main]
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
node-version:
- 20.x
- 22.x

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: 9

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
cache: pnpm

- name: Install dependencies
run: pnpm install
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm test
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers = false
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

17 changes: 17 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"recommendations": [
"yzhang.markdown-all-in-one",
"redhat.vscode-yaml",
"akamud.vscode-caniuse",
"visualstudioexptteam.intellicode-api-usage-examples",
"pflannery.vscode-versionlens",
"christian-kohler.npm-intellisense",
"esbenp.prettier-vscode",
"rangav.vscode-thunder-client",
"cweijan.vscode-database-client2",
"eamodio.gitlens",
"github.vscode-pull-request-github",
"github.vscode-github-actions",
"github.copilot"
]
}
146 changes: 89 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@
<img src="https://github.githubassets.com/images/modules/profile/achievements/pull-shark-default.png" width="100" height="100" alt="Pull Shark Achievement" />
</p>

[![License](https://img.shields.io/github/license/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/blob/main/LICENSE)
[![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)
[![GitHub last commit](https://img.shields.io/github/last-commit/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/commits)
[![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)
[![Node Version](https://img.shields.io/node/v/github-achievements-api)](https://nodejs.org)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.5.2-blue.svg)](https://www.typescriptlang.org/)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)
[![GitHub stars](https://img.shields.io/github/stars/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/network)
[![GitHub issues](https://img.shields.io/github/issues/wangrunlin/github-achievements-api)](https://github.com/wangrunlin/github-achievements-api/issues)
[![Visitors](https://visitor-badge.laobi.icu/badge?page_id=wangrunlin.github-achievements-api)](https://github.com/wangrunlin/github-achievements-api)
[![Ko-fi](https://img.shields.io/badge/Ko--fi-Support-orange)](https://ko-fi.com/wangrunlin)

English | [简体中文](README_zh.md)
[![License](https://img.shields.io/github/license/wangrunlin/github-achievements-api)][1]
[![GitHub package.json version](https://img.shields.io/github/package-json/v/wangrunlin/github-achievements-api)][2]
[![GitHub last commit](https://img.shields.io/github/last-commit/wangrunlin/github-achievements-api)][3]
[![Test Status](https://img.shields.io/github/actions/workflow/status/wangrunlin/github-achievements-api/test.yml?label=test)][4]
[![Node Version](https://img.shields.io/node/v/github-achievements-api)][5]
[![TypeScript](https://img.shields.io/badge/TypeScript-5.5.2-blue.svg)][6]
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)][7]
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)][8]
[![GitHub stars](https://img.shields.io/github/stars/wangrunlin/github-achievements-api)][9]
[![GitHub forks](https://img.shields.io/github/forks/wangrunlin/github-achievements-api)][10]
[![GitHub issues](https://img.shields.io/github/issues/wangrunlin/github-achievements-api)][11]
[![Visitors](https://visitor-badge.laobi.icu/badge?page_id=wangrunlin.github-achievements-api)][12]
[![Ko-fi](https://img.shields.io/badge/Ko--fi-Support-orange)][13]

English | [简体中文][14]

A simple API service for retrieving GitHub user achievements information. Built with Cloudflare Workers.

## Live Demo

- [https://github-achievements-api.wangrunlin.workers.dev](https://github-achievements-api.wangrunlin.workers.dev)
- [https://github-achievements-api.wangrunlin.workers.dev][15]

## Deploy to Cloudflare Workers

[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/wangrunlin/github-achievements-api)
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)][16]

## Features

Expand Down Expand Up @@ -56,25 +56,28 @@ GET https://<your-worker>.workers.dev/wangrunlin

```json
{
"total": {
"raw": 5, // Raw achievement count (without tiers)
"weighted": 8 // Weighted achievement count (with tiers)
},
"achievements": [
{
"type": "pair-extraordinaire",
"tier": 3
},
{
"type": "pull-shark",
"tier": 2
},
{
"type": "quickdraw",
"tier": 1
}
// ...
]
"total": {
"raw": 5, // Raw achievement count (without tiers)
"weighted": 8 // Weighted achievement count (with tiers)
},
"achievements": [
{
"type": "pair-extraordinaire",
"tier": 3,
"image": "https://some.cdn.com/path/to/pair-extraordinaire.png"
},
{
"type": "pull-shark",
"tier": 2,
"image": "https://some.cdn.com/path/to/pull-shark.png"
},
{
"type": "quickdraw",
"tier": 1,
"image": "https://some.cdn.com/path/to/quickdraw.png"
}
// ...
]
}
```

Expand Down Expand Up @@ -102,15 +105,15 @@ Example error response:

```json
{
"error": "Failed to fetch GitHub achievements: Not Found"
"error": "Failed to fetch GitHub achievements: Not Found"
}
```

## Roadmap

- [ ] Add support for achievement descriptions
- [ ] Add support for achievement dates
- [ ] Add support for achievement images
- [x] Add support for achievement images
- [ ] Add API key authentication
- [ ] Add more detailed statistics
- [ ] Add support for organization achievements
Expand All @@ -120,13 +123,13 @@ Example error response:

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

[![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/wangrunlin)
[![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)][17]

[Other sponsorship options](https://alin.run/sponsor)
[Other sponsorship options][18]

## Who's using GitHub Achievements API?

Are you using this API? [Let us know](https://github.com/wangrunlin/github-achievements-api/issues/new) and we'll add your logo here!
Are you using this API? [Let us know][19] and we'll add your logo here!

## Local Development

Expand Down Expand Up @@ -155,13 +158,13 @@ pnpm test

## Deployment

1. Login to Cloudflare
1. Login to Cloudflare

```bash
pnpm dlx wrangler login
```

2. Deploy Worker
2. Deploy Worker

```bash
pnpm deploy
Expand All @@ -182,21 +185,21 @@ MIT

Issues and Pull Requests are welcome!

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## Author

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

## Available Achievements

Here are all the achievements currently available on GitHub:

[View more details about GitHub Achievements](https://github.com/drknzz/GitHub-Achievements)
[View more details about GitHub Achievements][21]

| Achievement | Name | Description | Max Tiers |
| -------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------------------------------------------- | --------- |
Expand All @@ -214,10 +217,39 @@ Here are all the achievements currently available on GitHub:

Thanks to these awesome projects and resources:

- [GitHub](https://github.com) - For providing the achievement system
- [Cloudflare Workers](https://workers.cloudflare.com) - For the serverless platform
- [GitHub Achievements List](https://github.com/drknzz/GitHub-Achievements) - For the comprehensive achievements documentation
- [TypeScript](https://www.typescriptlang.org) - For the typed JavaScript
- [Vitest](https://vitest.dev) - For the testing framework
- [Wrangler](https://developers.cloudflare.com/workers/wrangler/) - For the development & deployment tool
- [pnpm](https://pnpm.io) - For the fast package manager
- [GitHub][22] - For providing the achievement system
- [Cloudflare Workers][23] - For the serverless platform
- [GitHub Achievements List][24] - For the comprehensive achievements documentation
- [TypeScript][25] - For the typed JavaScript
- [Vitest][26] - For the testing framework
- [Wrangler][27] - For the development & deployment tool
- [pnpm][28] - For the fast package manager

[1]: https://github.com/wangrunlin/github-achievements-api/blob/main/LICENSE
[2]: https://github.com/wangrunlin/github-achievements-api/blob/main/package.json
[3]: https://github.com/wangrunlin/github-achievements-api/commits
[4]: https://github.com/wangrunlin/github-achievements-api/actions
[5]: https://nodejs.org
[6]: https://www.typescriptlang.org/
[7]: https://github.com/prettier/prettier
[8]: https://makeapullrequest.com
[9]: https://github.com/wangrunlin/github-achievements-api/stargazers
[10]: https://github.com/wangrunlin/github-achievements-api/network
[11]: https://github.com/wangrunlin/github-achievements-api/issues
[12]: https://github.com/wangrunlin/github-achievements-api
[13]: https://ko-fi.com/wangrunlin
[14]: README_zh.md
[15]: https://github-achievements-api.wangrunlin.workers.dev
[16]: https://deploy.workers.cloudflare.com/?url=https://github.com/wangrunlin/github-achievements-api
[17]: https://ko-fi.com/wangrunlin
[18]: https://alin.run/sponsor
[19]: https://github.com/wangrunlin/github-achievements-api/issues/new
[20]: https://github.com/wangrunlin
[21]: https://github.com/drknzz/GitHub-Achievements
[22]: https://github.com
[23]: https://workers.cloudflare.com
[24]: https://github.com/drknzz/GitHub-Achievements
[25]: https://www.typescriptlang.org
[26]: https://vitest.dev
[27]: https://developers.cloudflare.com/workers/wrangler/
[28]: https://pnpm.io
Loading
Loading