Private Repository Setup Guide
Private Repository Setup Guide
This guide explains how to include private repositories in your website’s auto-update process.
Overview
By default, the GitHub auto-update script only fetches public repositories. This is because:
- The default GitHub Actions token (
GITHUB_TOKEN
) only has access to public repos - Private repositories may contain sensitive information not meant for public display
Enabling Private Repository Access
Step 1: Create a Personal Access Token (PAT)
- Go to GitHub Settings → Developer Settings → Personal Access Tokens → Tokens (classic)
- Click “Generate new token (classic)”
- Give it a descriptive name like “Website Auto-Update”
- Select the following scopes:
repo
(Full control of private repositories)read:user
(Read user profile data)
- Set an expiration date (recommend 90 days for security)
- Click “Generate token” and copy the token immediately
Step 2: Add the PAT to GitHub Secrets
- Go to your repository settings
- Navigate to Secrets and variables → Actions
- Click “New repository secret”
- Name:
PERSONAL_ACCESS_TOKEN
- Value: Paste your PAT from Step 1
- Click “Add secret”
Step 3: Update the GitHub Actions Workflow
Edit .github/workflows/update-website.yml
to use the PAT:
- name: 🚀 Update GitHub Repository Data
run: |
echo "Starting GitHub repository data update..."
cd scripts
python update_github_projects.py --include-private
env:
GITHUB_TOKEN: $
Security Considerations
⚠️ WARNING: Including private repositories on a public website has security implications:
- Repository Names: Private repo names will be visible
- Descriptions: Any descriptions will be public
- Statistics: Stars, forks, and update times will be shown
- URLs: Direct links to repositories (though they’ll still require authentication)
Best Practices
- Review Private Repos: Before enabling, review all your private repositories
- Update Descriptions: Ensure private repo descriptions don’t contain sensitive info
- Use Separate PAT: Don’t reuse PATs from other applications
- Rotate Regularly: Set expiration dates and rotate tokens periodically
- Monitor Usage: Check GitHub’s security log for PAT usage
Testing Locally
To test private repository access locally:
# Set your PAT as an environment variable
export GITHUB_TOKEN="your_personal_access_token_here"
# Run with private repos included
python scripts/update_github_projects.py --include-private
# Run without private repos (default)
python scripts/update_github_projects.py
Visual Indicators
Private repositories will be marked with a 🔒 lock icon in the repository list to indicate they’re private.
Excluding Specific Repositories
If you want more fine-grained control, you can modify the script to exclude specific repositories by name. Edit update_github_projects.py
and add an exclusion list:
# Add to the filter logic
excluded_repos = ['sensitive-project', 'client-work']
if repo['name'] in excluded_repos:
continue
Troubleshooting
- No private repos showing: Ensure your PAT has the
repo
scope - Authentication errors: Check that the secret name matches in the workflow
- Rate limits: PATs have higher rate limits than the default token
Reverting Changes
To stop including private repositories:
- Remove
--include-private
from the workflow - Optionally, delete the PAT from GitHub secrets
- The next auto-update will only include public repositories