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
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy Production

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy Production
steps:
- uses: actions/checkout@v4

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Deploy to Cloudflare Workers
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: deploy
32 changes: 32 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy Preview

on:
push:
branches-ignore:
- main

jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy Preview
steps:
- uses: actions/checkout@v4

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Deploy to Cloudflare Workers with Preview
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: deploy --env preview
141 changes: 75 additions & 66 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)][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]
[![License](https://img.shields.io/github/license/wangrunlin/github-achievements-api)][license]
[![GitHub package.json version](https://img.shields.io/github/package-json/v/wangrunlin/github-achievements-api)][package-json]
[![GitHub last commit](https://img.shields.io/github/last-commit/wangrunlin/github-achievements-api)][commits]
[![Test Status](https://img.shields.io/github/actions/workflow/status/wangrunlin/github-achievements-api/test.yml?label=test)][actions]
[![Node Version](https://img.shields.io/node/v/github-achievements-api)][nodejs]
[![TypeScript](https://img.shields.io/badge/TypeScript-5.7.3-blue.svg)][typescript]
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)][prettier]
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)][make-pr]
[![GitHub stars](https://img.shields.io/github/stars/wangrunlin/github-achievements-api)][stars]
[![GitHub forks](https://img.shields.io/github/forks/wangrunlin/github-achievements-api)][forks]
[![GitHub issues](https://img.shields.io/github/issues/wangrunlin/github-achievements-api)][issues]
[![Visitors](https://visitor-badge.laobi.icu/badge?page_id=wangrunlin.github-achievements-api)][repo]
[![Ko-fi](https://img.shields.io/badge/Ko--fi-Support-orange)][kofi]

English | [简体中文][readme-zh]

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

## Live Demo

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

## Deploy to Cloudflare Workers

[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)][16]
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)][deploy]

## Features

Expand Down Expand Up @@ -123,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)][17]
[![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)][kofi-button]

[Other sponsorship options][18]
[Other sponsorship options][sponsor]

## Who's using GitHub Achievements API?

Are you using this API? [Let us know][19] and we'll add your logo here!
Are you using this API? [Let us know][new-issue] and we'll add your logo here!

## Local Development

Expand Down Expand Up @@ -158,17 +158,26 @@ pnpm test

## Deployment

1. Login to Cloudflare
This project uses GitHub Actions to automatically deploy to Cloudflare Workers:

```bash
pnpm dlx wrangler login
```
- Commits to non-main branches create preview deployments
- Commits to main branch deploy to production

2. Deploy Worker
### Setup GitHub Secrets

```bash
pnpm deploy
```
To enable automatic deployments, you need to add the following secrets to your GitHub repository:

1. Go to your repository on GitHub
2. Navigate to Settings > Secrets and variables > Actions
3. Add the following secrets:
- `CF_API_TOKEN`: Your Cloudflare API token with Workers permissions

### How to get Cloudflare credentials

1. **Cloudflare API Token**:
- Go to the [Cloudflare dashboard](https://dash.cloudflare.com/)
- Navigate to My Profile > API Tokens
- Create a new token with "Edit Workers" permissions

## Tech Stack

Expand All @@ -193,13 +202,13 @@ Issues and Pull Requests are welcome!

## Author

[Leo Wang][20]
[Leo Wang][author]

## Available Achievements

Here are all the achievements currently available on GitHub:

[View more details about GitHub Achievements][21]
[View more details about GitHub Achievements][github-achievements]

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

Thanks to these awesome projects and resources:

- [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
- [GitHub][github] - For providing the achievement system
- [Cloudflare Workers][cloudflare-workers] - For the serverless platform
- [GitHub Achievements List][github-achievements-list] - For the comprehensive achievements documentation
- [TypeScript][typescript-site] - For the typed JavaScript
- [Vitest][vitest] - For the testing framework
- [Wrangler][wrangler] - For the development & deployment tool
- [pnpm][pnpm] - For the fast package manager

[license]: https://github.com/wangrunlin/github-achievements-api/blob/main/LICENSE
[package-json]: https://github.com/wangrunlin/github-achievements-api/blob/main/package.json
[commits]: https://github.com/wangrunlin/github-achievements-api/commits
[actions]: https://github.com/wangrunlin/github-achievements-api/actions
[nodejs]: https://nodejs.org
[typescript]: https://www.typescriptlang.org/
[prettier]: https://github.com/prettier/prettier
[make-pr]: https://makeapullrequest.com
[stars]: https://github.com/wangrunlin/github-achievements-api/stargazers
[forks]: https://github.com/wangrunlin/github-achievements-api/network
[issues]: https://github.com/wangrunlin/github-achievements-api/issues
[repo]: https://github.com/wangrunlin/github-achievements-api
[kofi]: https://ko-fi.com/wangrunlin
[readme-zh]: README_zh.md
[demo]: https://github-achievements-api.wangrunlin.workers.dev
[deploy]: https://deploy.workers.cloudflare.com/?url=https://github.com/wangrunlin/github-achievements-api
[kofi-button]: https://ko-fi.com/wangrunlin
[sponsor]: https://alin.run/sponsor
[new-issue]: https://github.com/wangrunlin/github-achievements-api/issues/new
[author]: https://github.com/wangrunlin
[github-achievements]: https://github.com/drknzz/GitHub-Achievements
[github]: https://github.com
[cloudflare-workers]: https://workers.cloudflare.com
[github-achievements-list]: https://github.com/drknzz/GitHub-Achievements
[typescript-site]: https://www.typescriptlang.org
[vitest]: https://vitest.dev
[wrangler]: https://developers.cloudflare.com/workers/wrangler/
[pnpm]: https://pnpm.io
Loading