This guide explains how to develop and test the portfolio website locally.
- Python 3.11+ (for the GitHub metadata script)
- Web browser (Chrome, Firefox, or Safari)
- Local web server (Python
http.serverornpx serve) - GitHub Personal Access Token (for local testing of the Python script)
cd .github/scripts/
pip install -r requirements.txtCreate a .env file in the repository root:
# Copy the example file
cp .env.example .env
# Edit .env with your values
# (Use your favorite editor)Edit .env file:
GITHUB_TOKEN=ghp_your_actual_token_here
GITHUB_REPOSITORY_OWNER=Avery2Creating a GitHub Token:
- Go to https://github.com/settings/tokens
- Click "Generate new token (classic)"
- Give it a name (e.g., "Portfolio Local Testing")
- Select scopes:
repo(Full control of private repositories) - Click "Generate token"
- Copy the token and paste it into your
.envfile
Note: The .env file is in .gitignore - it will never be committed!
To test the GitHub data fetching script:
cd .github/scripts/
python fetch-github-data.pyThis will:
- Fetch all your repositories from GitHub
- Generate
data/github-projects.yml - Detect images in
assets/images/projects/ - Calculate priorities based on stars and recency
From the repository root:
# Option 1: Python (built-in)
python -m http.server 8000
# Option 2: Node.js (if you have npx)
npx serve .
# Option 3: PHP (if you have PHP)
php -S localhost:8000http://localhost:8000
You should see your portfolio website with all tiles loaded!
Edit data/site-config.yml and refresh the browser.
Edit data/manual-tiles.yml to add custom tiles (resume, about, etc.), then refresh.
- Edit CSS files in
css/ - Hard-refresh browser:
Cmd+Shift+R(Mac) orCtrl+Shift+R(Windows/Linux)
- Edit JS files in
js/ - Hard-refresh browser to clear cache
Edit data/filter-groups.yml to change filter options, then refresh.
Before committing changes, verify:
-
Python script runs without errors
python .github/scripts/fetch-github-data.py
-
data/github-projects.ymlgenerated correctlycat data/github-projects.yml | head -50 -
All images linked properly
- Check browser console (F12) for 404 errors
- Verify images in
assets/images/projects/match repo names
-
Website loads in browser
- No errors in console
- All tiles render correctly
-
Filtering works
- Language filters toggle correctly
- Category filters work
- Search finds correct projects
- Sort options change order
-
Theme toggle works
- Click theme button cycles: Light → Dark → Auto
- Preference persists after refresh
-
Responsive design works
- Resize browser window
- Check mobile view (toggle device toolbar in DevTools)
- Verify 1 column on mobile, 2-4 on desktop
Push to main branch → GitHub Actions runs automatically:
git add .
git commit -m "Your commit message"
git push origin mainGitHub Actions will:
- Run
generate-metadata.yml(fetches latest GitHub data) - Run
deploy.yml(deploys to GitHub Pages)
- Go to GitHub Actions tab: https://github.com/Avery2/Avery2.github.io/actions
- Select "Generate Project Metadata" workflow
- Click "Run workflow"
- Select branch (usually
main) - Click "Run workflow"
This is useful for testing on a feature branch before merging.
The workflow runs automatically every Sunday at 00:00 UTC.
No action needed - your GitHub projects data stays fresh!
Problem: Script fails with "GITHUB_TOKEN environment variable not set"
Solution:
- Make sure
.envfile exists in repository root:ls -la .env
- Check
.envfile has your token:cat .env # Should show GITHUB_TOKEN=ghp_... - If
.envdoesn't exist, copy from example:cp .env.example .env # Then edit .env with your token - Create token if you don't have one: https://github.com/settings/tokens
Problem: Tiles show placeholder instead of project images
Solution:
- Check filename matches repo name exactly:
assets/images/projects/steam-hours.jpg ✓ assets/images/projects/Steam-Hours.jpg ✗ (wrong case) - Verify image path in
data/github-projects.yml:image: "./assets/images/projects/steam-hours.jpg"
- Try hard refresh:
Cmd+Shift+R
Problem: Website shows error or tiles don't load
Solution:
- Validate YAML syntax:
python -c "import yaml; yaml.safe_load(open('data/github-projects.yml'))" - Check for special characters in descriptions
- Ensure consistent indentation (2 spaces)
Problem: Grid shows loading spinner forever or no tiles appear
Solution:
- Check browser console for errors:
F12→ Console tab - Verify YAML files loaded correctly:
- Open Network tab (F12)
- Refresh page
- Check for 404 errors on
.ymlfiles
- Check YAML file syntax (see above)
- Verify file paths are correct (relative to repo root)
Problem: Script fails or produces incorrect output
Solution:
- Check Python version:
python --version # Should be 3.11+ - Reinstall dependencies:
pip install -r .github/scripts/requirements.txt --upgrade
- Verify token has
reposcope - Check rate limits:
curl -H "Authorization: Bearer $GITHUB_TOKEN" \ https://api.github.com/rate_limit
Problem: Workflow fails in GitHub Actions
Solution:
- Check workflow run logs:
- Go to Actions tab
- Click on failed run
- Read error messages
- Common issues:
- Permissions: Ensure
contents: writein workflow - Token expiration:
GITHUB_TOKENis auto-renewed - Python errors: Check script syntax
- Permissions: Ensure
- Test locally first before pushing
| Aspect | Local | GitHub Actions |
|---|---|---|
| Token | Personal Access Token (PAT) | GITHUB_TOKEN (automatic) |
| Owner | Manual export |
Auto from GITHUB_REPOSITORY_OWNER |
| Commit | Manual (git add, git commit) |
Automatic (bot commits) |
| Permissions | Your personal account | Repo/fork owner's account |
| Speed | Instant feedback | ~1-2 min workflow time |
When to use local:
- Quick testing before committing
- Debugging script issues
- Validating YAML output
- Experimenting with changes
When to use GitHub Actions:
- Production deployments
- Scheduled updates
- Testing fork behavior
- Automated workflows
-
Use browser DevTools:
Cmd+Option+I(Mac) orF12(Windows/Linux)- Use "Toggle Device Toolbar" for responsive testing
- Console shows errors immediately
-
Live Server Extension:
- Install VS Code "Live Server" extension
- Right-click
index.html→ "Open with Live Server" - Auto-refreshes on file save
-
Hard Refresh:
- Clear cache:
Cmd+Shift+R(Mac) orCtrl+Shift+R(Windows/Linux) - Or open DevTools → right-click refresh → "Empty Cache and Hard Reload"
- Clear cache:
- JavaScript: Use browser console for debugging
- CSS: Use DevTools to inspect styles in real-time
- YAML: Validate before committing
- Python: Run script locally before pushing
# Create feature branch
git checkout -b feature/my-changes
# Make changes and test locally
# ...
# Commit changes
git add .
git commit -m "Description of changes"
# Push to GitHub
git push origin feature/my-changes
# Test on GitHub Actions (manual trigger)
# Go to Actions → Run workflow on feature branch
# Merge when ready
git checkout main
git merge feature/my-changes
git push origin mainOnce local development is working:
-
Customize your site:
- Update
data/site-config.ymlwith your info - Add project images to
assets/images/projects/ - Create custom tiles in
data/manual-tiles.yml
- Update
-
Test thoroughly:
- Check all features work
- Test responsive design
- Verify cross-browser compatibility
-
Deploy:
- Push to
mainbranch - Verify GitHub Pages deployment
- Check live site at your custom domain
- Push to
- Plan Document:
/Users/averychan/.claude/plans/sharded-dreaming-rossum.md - GitHub API Docs: https://docs.github.com/en/rest
- GitHub Actions Docs: https://docs.github.com/en/actions
- YAML Syntax: https://yaml.org/spec/1.2/spec.html
Happy coding! 🚀