Skip to content

Commit 4a8839c

Browse files
committed
Update environment variable names from GITHUB_* to GH_*
GitHub does not allow secrets starting with GITHUB_ prefix. Changed all references to use GH_TOKEN and GH_USERNAME instead.
1 parent fef37b2 commit 4a8839c

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# Create a token at: https://github.com/settings/tokens
33
# Required scopes: read:user, public_repo
44
# This token is used during the build process to fetch your GitHub profile data
5-
GITHUB_TOKEN=ghp_your_token_here
5+
GH_TOKEN=ghp_your_token_here
66

77
# GitHub Username (REQUIRED)
88
# The GitHub username whose profile will be displayed on the static site
99
# Example: octocat
10-
GITHUB_USERNAME=your-github-username
10+
GH_USERNAME=your-github-username
1111

1212
# Base Path (OPTIONAL)
1313
# Use this if your site is deployed to a subdirectory (e.g., https://username.github.io/repo-name/)

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242

4343
- name: Build site
4444
env:
45-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
46-
GITHUB_USERNAME: ${{ secrets.GH_USERNAME }}
45+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
46+
GH_USERNAME: ${{ secrets.GH_USERNAME }}
4747
BASE_PATH: ${{ secrets.BASE_PATH || '' }}
4848
CUSTOM_DOMAIN: ${{ secrets.CUSTOM_DOMAIN || '' }}
4949
run: npm run build

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ CheckMyGit generates a static portfolio site for a single GitHub profile. The si
101101
Edit `.env` and add your configuration:
102102
```env
103103
# Required: GitHub Personal Access Token with 'read:user' scope
104-
GITHUB_TOKEN=ghp_your_token_here
104+
GH_TOKEN=ghp_your_token_here
105105
106106
# Required: Your GitHub username
107-
GITHUB_USERNAME=your-username
107+
GH_USERNAME=your-username
108108
109109
# Optional: Base path if deploying to a subdirectory (e.g., /repo-name)
110110
BASE_PATH=
@@ -118,7 +118,7 @@ CheckMyGit generates a static portfolio site for a single GitHub profile. The si
118118
Edit `site.config.js` to customize your portfolio:
119119
```javascript
120120
export default {
121-
username: process.env.GITHUB_USERNAME || 'your-username',
121+
username: process.env.GH_USERNAME || 'your-username',
122122
defaultTemplate: 'github', // 'github' | 'bento' | 'minimal'
123123
basePath: process.env.BASE_PATH || '',
124124
customDomain: process.env.CUSTOM_DOMAIN || '',
@@ -150,8 +150,8 @@ CheckMyGit generates a static portfolio site for a single GitHub profile. The si
150150

151151
| Variable | Description | Example |
152152
|----------|-------------|---------|
153-
| `GITHUB_TOKEN` | GitHub Personal Access Token with `read:user` scope | `ghp_abc123...` |
154-
| `GITHUB_USERNAME` | Your GitHub username to display | `octocat` |
153+
| `GH_TOKEN` | GitHub Personal Access Token with `read:user` scope | `ghp_abc123...` |
154+
| `GH_USERNAME` | Your GitHub username to display | `octocat` |
155155

156156
### Optional Variables
157157

@@ -315,7 +315,7 @@ defaultTemplate: 'bento' // or 'minimal' or 'github'
315315

316316
## Troubleshooting
317317

318-
### Build Fails with "GITHUB_TOKEN is required"
318+
### Build Fails with "GH_TOKEN is required"
319319

320320
Make sure you've added the `GH_TOKEN` secret in your repository settings.
321321

site.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
export default {
99
// GitHub username для отображения (может быть переопределен через env)
10-
username: process.env.GITHUB_USERNAME || 'your-username',
10+
username: process.env.GH_USERNAME || 'your-username',
1111

1212
// Шаблон по умолчанию: 'github' | 'bento' | 'minimal'
1313
defaultTemplate: 'github',

src/lib/build/fetchProfileData.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import { fetchGitHubProfile } from '$lib/server/github';
1414
export async function fetchProfileDataAtBuildTime(
1515
username: string
1616
): Promise<GitHubProfile> {
17-
const GITHUB_TOKEN = env.GITHUB_TOKEN;
17+
const GH_TOKEN = env.GH_TOKEN;
1818

19-
// Check for required GITHUB_TOKEN
20-
if (!GITHUB_TOKEN) {
19+
// Check for required GH_TOKEN
20+
if (!GH_TOKEN) {
2121
throw new Error(
22-
'GITHUB_TOKEN environment variable is required for build-time data fetching. ' +
22+
'GH_TOKEN environment variable is required for build-time data fetching. ' +
2323
'Please set it in your environment or GitHub Secrets. ' +
2424
'You can create a token at: https://github.com/settings/tokens'
2525
);
@@ -29,7 +29,7 @@ export async function fetchProfileDataAtBuildTime(
2929
if (!username || username.trim() === '') {
3030
throw new Error(
3131
'GitHub username is required for build-time data fetching. ' +
32-
'Please set GITHUB_USERNAME in your environment or site.config.js'
32+
'Please set GH_USERNAME in your environment or site.config.js'
3333
);
3434
}
3535

@@ -57,7 +57,7 @@ export async function fetchProfileDataAtBuildTime(
5757
case 'UNAUTHORIZED':
5858
throw new Error(
5959
'Failed to fetch GitHub profile: Invalid or expired GitHub token. ' +
60-
'Please verify your GITHUB_TOKEN is correct and has the required permissions (read:user). ' +
60+
'Please verify your GH_TOKEN is correct and has the required permissions (read:user). ' +
6161
'You can create a new token at: https://github.com/settings/tokens'
6262
);
6363

0 commit comments

Comments
 (0)