Skip to content

Commit 3d4a6a2

Browse files
committed
Add authenticated GitHub API access for builds
1 parent 098a674 commit 3d4a6a2

4 files changed

Lines changed: 48 additions & 4 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
node-version: '18'
1515
- run: npm install
1616
- run: npm run build
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1719
- uses: peaceiris/actions-gh-pages@v3
1820
with:
1921
github_token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,39 @@ cd DecisionsDev.github.io
2323
# Install dependencies
2424
npm install
2525

26+
# Optional: authenticate GitHub API requests to avoid rate limits
27+
# PowerShell
28+
$env:GITHUB_TOKEN="your_github_token_here"
29+
30+
# Bash
31+
export GITHUB_TOKEN="your_github_token_here"
32+
2633
# Start development server
2734
npm run dev
2835
```
2936

3037
The site will be available at `http://localhost:8000`
3138

39+
### GitHub API Authentication
40+
41+
Several repository tooling scripts call the GitHub REST API. Unauthenticated requests are heavily rate-limited and can fail with HTTP 403 responses such as “API rate limit exceeded”.
42+
43+
Set [`GITHUB_TOKEN`](README.md:32) before running [`npm run build`](package.json:11), [`npm run build:repos`](package.json:9), [`npm run build:videos`](package.json:10), or direct tooling like [`tools/build-repositories.js`](tools/build-repositories.js), [`tools/extract-videos.js`](tools/extract-videos.js), and [`tools/generate-topics-report.js`](tools/generate-topics-report.js).
44+
45+
Use a GitHub personal access token with at least public repository read access.
46+
47+
```powershell
48+
# PowerShell
49+
$env:GITHUB_TOKEN="your_github_token_here"
50+
npm run build
51+
```
52+
53+
```bash
54+
# Bash
55+
export GITHUB_TOKEN="your_github_token_here"
56+
npm run build
57+
```
58+
3259
## 📁 Project Structure
3360

3461
```
@@ -76,7 +103,7 @@ npm run build:repos
76103
# Fetch and categorize videos from GitHub
77104
npm run build:videos
78105

79-
# Build for production (includes build:repos)
106+
# Build for production (includes GitHub API-backed data refresh)
80107
npm run build
81108

82109
# Serve production build locally

docs/DEPLOYMENT.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,23 @@ jobs:
143143
144144
## Updating Repository Data
145145
146-
Before deploying, you may want to update the repository list:
146+
Before deploying, you may want to update the repository list.
147+
148+
Authenticated GitHub API access is recommended because unauthenticated requests can fail with HTTP 403 rate-limit errors.
149+
150+
```powershell
151+
# PowerShell
152+
$env:GITHUB_TOKEN="your_github_token_here"
153+
npm run build:repos
154+
```
147155

148156
```bash
149-
node fetch-repos.js > src/data/repositories.json
157+
# Bash
158+
export GITHUB_TOKEN="your_github_token_here"
159+
npm run build:repos
150160
```
151161

152-
This fetches the latest repositories from the DecisionsDev organization.
162+
This runs [`tools/build-repositories.js`](tools/build-repositories.js), which fetches the latest repositories from the DecisionsDev organization and rebuilds [`src/data/repositories.json`](src/data/repositories.json).
153163

154164
## Support
155165

docs/SETUP.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,15 @@ The site will be available at `http://localhost:8000`
9292
## Step 5: Build for Production
9393

9494
```bash
95+
# Optional but recommended to avoid GitHub API rate limiting
96+
export GITHUB_TOKEN=your_github_token_here
97+
9598
# Build the site
9699
npm run build
97100
```
98101

102+
On PowerShell, use [`$env:GITHUB_TOKEN="your_github_token_here"`](docs/README-TOPICS-SCRIPT.md:61) instead of [`export`](docs/SETUP.md:95).
103+
99104
This creates optimized production files in the `public/` directory.
100105

101106
**Verify:**

0 commit comments

Comments
 (0)