Skip to content

fix: replace unreliable contributor stats aggregation workflow#321

Merged
mattqdev merged 4 commits into
physicshub:mainfrom
AgnibhaDebnath:fix-contributor-stats
May 20, 2026
Merged

fix: replace unreliable contributor stats aggregation workflow#321
mattqdev merged 4 commits into
physicshub:mainfrom
AgnibhaDebnath:fix-contributor-stats

Conversation

@AgnibhaDebnath
Copy link
Copy Markdown
Contributor

📘 Pull Request – Fix contributor image generation and stats aggregation

🔍 Description

This PR fixes the broken contributor image generation workflow and refactors the contributor statistics aggregation system by replacing the unreliable /stats/contributors endpoint polling workflow with commit-history aggregation using the GitHub commits API.

Main improvements

  • Fixed contributor image generation by correcting local HTML file path handling for Puppeteer screenshot rendering
  • Removed repeated per-contributor stats polling
  • Implemented bulk commit aggregation
  • Added commit pagination handling
  • Added merge-commit filtering to better match GitHub Insights
  • Reduced unnecessary API calls
  • Improved contributor stats caching

The new implementation now:

  • correctly generates the contributor image locally and in workflow environments,
  • aggregates additions/deletions/commits directly from repository commit history,
  • updates automatically when new commits are added,
  • avoids dependency on GitHub’s frequently delayed 202 Accepted stats endpoint.

Most contributor statistics now closely match GitHub Insights. Only 2–3 contributors (mainly large maintainer/bot accounts) still show small additions/deletions differences, likely due to GitHub internal aggregation heuristics.

Closes #318


✅ Checklist

  • Verified that the project builds and runs locally (npm run dev)
  • Ensured no ESLint or TypeScript warnings/errors remain
  • Updated documentation/comments where needed
  • Followed the CONTRIBUTING.md guidelines

🎨 Visual Changes (if UI-related)

No UI changes.


📂 Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ♻️ Refactor / code quality improvement

🧩 Additional Notes for Reviewers

GitHub contributor statistics are now generated using commit-history aggregation instead of relying on /stats/contributors, which frequently returned incomplete 202 Accepted responses during testing.

The implementation now performs:

  • bulk commit fetching,
  • commit-detail aggregation,
  • merge exclusion,
  • contributor caching,
  • automatic stats updates on new commits.

@mattqdev
Copy link
Copy Markdown
Collaborator

Thank you for the pr, i think there are some conflicts to fix (idk why honestly)

@AgnibhaDebnath AgnibhaDebnath force-pushed the fix-contributor-stats branch from 35491fb to e00e1e9 Compare May 20, 2026 19:18
@AgnibhaDebnath
Copy link
Copy Markdown
Contributor Author

Thanks! I resolved the merge conflicts and rebased the branch on the latest main. The conflicts were mainly caused by regenerated contributor output files after adding stats support to the contributor image generation workflow.

@mattqdev
Copy link
Copy Markdown
Collaborator

Thank you!

@mattqdev mattqdev merged commit 145ba0c into physicshub:main May 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Contributor image on the README is broken

2 participants