Skip to content

Commit 2ead611

Browse files
authored
Fetch Dates from Github (#96)
* clean up code * update project decoder * Setup project year stuff * use githubRepo field instead of githubLink * store github repo instead of link * Fix typo * [refactor] split `RawData` and `ProcessedData` for better extensibility * Use gihtub API to get date ranges * fix ptable github repo * Read `GITHUB_TOKEN` env when building * ue `dotenvx` to handle script-level loading of env files
1 parent 55345d6 commit 2ead611

File tree

9 files changed

+766
-119
lines changed

9 files changed

+766
-119
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ jobs:
4242

4343
- name: Build
4444
run: pnpm build
45-
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
4648
- name: Add `static/` to `dist/`
4749
run: mv static/* dist
4850

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ dist/
55
functions/render/elm-pages-cli.js
66

77
.DS_Store
8-
.pnpm-store
8+
.pnpm-store
9+
10+
.env

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,21 @@ Open up the project in a devcontainer, then run the following
88

99
```
1010
pnpm i
11+
touch .env
1112
pnpm dev
1213
```
14+
15+
## Environment Variables
16+
17+
Create a `.env` file in the root of the project with the following variables.
18+
19+
```env
20+
# optional - if you want to increase the rate limit for the GitHub API
21+
GITHUB_TOKEN=your_github_pat
22+
```
23+
24+
### `GITHUB_TOKEN`
25+
26+
My website uses the GitHub API to fetch data in my public repos. The calls should be cached but sometimes in development you might hit the rate limit. To increase the limit you can create a personal access token and add it to the `.env` file.
27+
28+
A PAT with read-only access to public repos is sufficient.

app/Route/Index.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Icon
1717
import Icosahedron
1818
import Pages.Url
1919
import PagesMsg exposing (PagesMsg)
20-
import Project exposing (Language, Project)
20+
import Project exposing (Project)
2121
import Route
2222
import RouteBuilder exposing (App, StatefulRoute)
2323
import Shared

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
"type": "module",
44
"scripts": {
55
"postinstall": "elm-tooling install",
6-
"dev": "elm-pages dev",
6+
"dev": "dotenvx run -- elm-pages dev",
77
"build": "elm-pages build",
88
"serve": "pnpm build && http-server ./dist -a localhost -p 3000 -c-1"
99
},
1010
"devDependencies": {
11+
"@dotenvx/dotenvx": "^0.37.0",
1112
"elm-codegen": "0.5.3",
1213
"elm-optimize-level-2": "0.3.5",
1314
"elm-pages": "3.0.12",

0 commit comments

Comments
 (0)