Overview
The project uses GitHub Actions to automate data updates and deployments. Two workflow files handle continuous integration and automated regeneration of GitHub statistics.Workflow Files
Regeneration Workflow
Location:.github/workflows/deploy.yaml
This workflow automatically fetches fresh GitHub contribution data and deploys to Cloudflare Workers.
CI Workflow
Location:.github/workflows/ci.yaml
This workflow runs on every push to validate code quality.
Scheduled Updates
Cron Schedule
The regeneration workflow runs automatically twice a day:0 0,12 * * *
0- At minute 0 (top of the hour)0,12- At hours 0 (midnight) and 12 (noon)* * *- Every day of the month, every month, every day of the week
Customizing the Schedule
You can modify the cron expression to change update frequency: Every 6 hours:Workflow Steps Explained
1. Checkout Repository
2. Setup pnpm
package.json:
3. Setup Node.js
4. Install Dependencies
package.json.
5. Fetch GitHub Statistics
- Fetches GitHub contribution data via GraphQL API
- Fetches WhatPulse statistics
- Writes data to
src/stats.jsonandsrc/pulse.json
GH_SECRET environment variable authenticates with GitHub.
6. Deploy to Cloudflare
Workflow Triggers
Push to Main Branch
main branch.
Manual Trigger
To run the workflow manually, add:- Go to Actions in your repository
- Select the workflow
- Click Run workflow
Data Generated
Thepnpm stats command generates:
src/stats.json
Contains GitHub contribution data:src/pulse.json
Contains WhatPulse statistics (keyboard/mouse activity).Environment Variables
The workflows require these GitHub secrets:GH_SECRET- GitHub Personal Access TokenCLOUDFLARE_API_TOKEN- Cloudflare API tokenCLOUDFLARE_ACCOUNT_ID- Cloudflare account ID
Monitoring Workflows
View Workflow Runs
- Go to your repository on GitHub
- Click the Actions tab
- View recent workflow runs, logs, and status
Email Notifications
GitHub automatically sends email notifications when workflows fail. Configure this in your GitHub notification settings.Workflow Status Badge
Add a status badge to your README:Troubleshooting
Workflow Fails on “fetch stats” Step
Cause: Invalid or missingGH_SECRET.
Solution:
- Verify the secret is set in repository settings
- Ensure the token has
read:userscope - Check if the token has expired
Workflow Fails on “deploy” Step
Cause: Invalid Cloudflare credentials. Solution:- Verify
CLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_IDare set - Check the API token has Workers Scripts edit permissions
- Ensure the account ID matches your Cloudflare account
Workflow Doesn’t Trigger on Schedule
Causes:- Scheduled workflows may be delayed during high GitHub load
- Repository must have recent activity (push within 60 days)
- Default branch must be
main(or update workflow branch filter)
- Wait 10-15 minutes after the scheduled time
- Make a commit to ensure repository is active
- Manually trigger the workflow to test
Dependency Installation Fails
Cause: Package version conflicts or network issues. Solution:- Update dependencies:
pnpm update - Clear cache by re-running the workflow
- Check pnpm and Node.js versions match
package.json
Best Practices
Caching
The workflows use pnpm caching for faster builds:Version Pinning
Pin specific versions for reproducibility:Error Handling
Workflows fail fast by default. Add error handling if needed:Next Steps
- Configure Environment Variables
- Set up Cloudflare Workers Deployment
- Customize the cron schedule for your needs
- Monitor workflow runs in the GitHub Actions tab