Skip to content

Commit 90be7fe

Browse files
committed
docs: update readme
1 parent 66f0b04 commit 90be7fe

File tree

4 files changed

+109
-3
lines changed

4 files changed

+109
-3
lines changed

README.md

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,107 @@
1-
# GitHub breakout
1+
# Github Breakout
22

3-
Generate a Breakout game SVG from a GitHub contribution graph
3+
Generate a Breakout game SVG from a GitHub user's contributions graph
4+
5+
This project will grab your contribution graph through the GitHub API and generate images for light and dark mode:
6+
7+
<picture>
8+
<source
9+
media="(prefers-color-scheme: dark)"
10+
srcset="example/dark.svg"
11+
/>
12+
<source
13+
media="(prefers-color-scheme: light)"
14+
srcset="example/light.svg"
15+
/>
16+
<img alt="Breakout Game" src="example/light.svg" />
17+
</picture>
18+
19+
## Usage
20+
21+
### GitHub Action
22+
23+
You can use the provided GitHub Action to build the SVGs so you can display them like on my profile ([github.com/cyprieng](https://github.com/cyprieng)):
24+
25+
Generate the SVGs every day and commit them to your repository:
26+
27+
```yaml
28+
name: generate breakout svg
29+
30+
on:
31+
schedule:
32+
- cron: "0 */24 * * *"
33+
workflow_dispatch:
34+
35+
jobs:
36+
generate-svg:
37+
permissions:
38+
contents: write
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 5
41+
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v4
45+
46+
- name: generate SVG
47+
uses: cyprieng/[email protected]
48+
with:
49+
github_username: ${{ github.repository_owner }}
50+
51+
- name: Move generated SVGs
52+
run: |
53+
mkdir -p images
54+
mv output/light.svg images/breakout-light.svg
55+
mv output/dark.svg images/breakout-dark.svg
56+
57+
- name: Configure git
58+
run: |
59+
git config user.name "github-actions[bot]"
60+
git config user.email "github-actions[bot]@users.noreply.github.com"
61+
62+
- name: Commit and push SVGs
63+
run: |
64+
git add images/breakout-light.svg images/breakout-dark.svg
65+
git commit -m "chore: update breakout SVGs" || echo "No changes to commit"
66+
git push
67+
```
68+
69+
Add them to your README.md:
70+
71+
```html
72+
<picture>
73+
<source
74+
media="(prefers-color-scheme: dark)"
75+
srcset="images/breakout-dark.svg"
76+
/>
77+
<source
78+
media="(prefers-color-scheme: light)"
79+
srcset="images/breakout-light.svg"
80+
/>
81+
<img alt="Breakout Game" src="images/breakout-light.svg" />
82+
</picture>
83+
```
84+
85+
### CLI
86+
87+
You need to get a GitHub Token, then you can run the following command:
88+
89+
`node dist/cli.js {username} {github token} {dark mode: true/false}`
90+
91+
### Library
92+
93+
The package is currently not available on npm, so you can install it with:
94+
95+
`npm i --save git+ssh://[email protected]:cyprieng/github-breakout.git`
96+
97+
And then you can use it like this:
98+
99+
```javascript
100+
import { generateSVG } from "github-breakout";
101+
102+
await generateSVG(username, token, false);
103+
```
104+
105+
### Try it
106+
107+
You can try it here: [www.cyprien.io/projects/github-breakout](https://www.cyprien.io/projects/github-breakout/#try-it)

example/dark.svg

Lines changed: 1 addition & 0 deletions
Loading

example/light.svg

Lines changed: 1 addition & 0 deletions
Loading

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "github-breakout",
33
"version": "1.0.0",
4-
"description": "Generate a Breakout game svg from github contribution graph",
4+
"description": "Generate a Breakout game SVG from a GitHub user's contributions graph",
55
"main": "src/index.js",
66
"scripts": {
77
"dev": "ts-node src/cli.ts",

0 commit comments

Comments
 (0)