-
-
Notifications
You must be signed in to change notification settings - Fork 2k
WIP: Fix recent languages after GitHub API change (Cannot destructure property 'committer' of 'undefined') #1754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Any updates on this? I'm also having the same issue @lowlighter |
|
It is functional but not suited for merging as-is, and I haven't looked into the other parts of the code also broken by this API change. You can see my config here for how to use this branch; I would advice pinning to specific commit rather than my workbranch. It runs much slower than the pre-compiled version, as it compiles the whole thing each time. lowlighter has stated on their profile that this project is currently on the backburner, so I wouldn't expect a speedy response from them. I don't have time right now to work more on this, but with the changes I've done so far, the recent languages functionality is back, and the workflow is no longer crashing with my particular configuration, tho it is throwing (non-fatal) errors in other modules (such as the recent coding habbits – not rendering anything, but also not failing the workflow). |
Yup. It's a bit of a shame, but I've resorted to forking under @gh-metrics.
(Same for the @gh-metrics, haven't set up tagging, it's still pretty YOLO for now)
If you want to send a PR over to @gh-metrics, I'd be game to work on getting it fixed.
I clearly haven't looked closely enough at v3 (mostly was messing around with v4 back when I forked) |
|
I might look into sending you a pr at some point, but I'm likely not going to give it top priority. Yes, it is JavaScript, but it is also compiled (or, more specifically, transpiled - most non-vanilla-browser-js is). Feel free to cherry-pick commits if I don't get around to making a PR within a reasonable time, if you're comfortable with the more advanced parts of the git workflow. This PR was intended as a "I fixed it, here's how I did it – but there is more to be done". Just make sure git attribution is proper. |
I'm certainly not asking you to PR if you don't want to, I just didn't to CP your PR if you'd prefer to do it yourself (I know some people can be picky about that).
ofc!
Is it transpiled? I don't transpiler installed anywhere but maybe I'm just being blind. But yeah, the Docker's messed up. I'm thinking about probably making a CP of #1724 too and seeing if that helps. And thanks for all your hard work! |
Uses exact implementation from oddstr13's PR lowlighter#1754: - Builds wanted map with repo@ref keys - Fetches commits via REST API directly - Tracks before/head SHAs for early exit - Uses optional chaining to prevent destructuring errors - Fetches full commit details with file patches
Implements PR lowlighter#1754 fix using direct REST API commit fetching: - GitHub Events API removed commit details from push payloads (Aug 2025) - Uses REST API endpoints to fetch commits directly per repo/branch - Builds wanted map for selective commit fetching with early exit - Filters commits by authoring email safely using optional chaining - Fetches full commit details with file patches for language analysis - Verified working with multiple languages across repositories
Implements PR lowlighter#1754 fix using direct REST API commit fetching: - GitHub Events API removed commit details from push payloads (Aug 2025) - Uses REST API endpoints to fetch commits directly per repo/branch - Builds wanted map for selective commit fetching with early exit - Filters commits by authoring email safely using optional chaining - Fetches full commit details with file patches for language analysis - Verified working with multiple languages across repositories
It is provided for discussion and community visibility. The quality of this code is not suitable for merging as-is.
This PR fixes the following error causing failure to update svg and failed action runs;
GitHub recently changed the APIs used to get some of the commit information used in the recent languages portion of the code. API version was not bumped, and the breaking changes documentation was not updated, so it took me a while to figure out what had gone wrong. Once I did, however, I found this blog post that hints at what they where doing and why; https://github.blog/changelog/2025-08-08-upcoming-changes-to-github-events-api-payloads/
Specifically, this part of the
PushEventno longer exists:metrics/tests/mocks/api/github/rest/activity/listEventsForAuthenticatedUser.mjs
Lines 271 to 280 in 582a522
I'm not familiar with the code base, nor particularly familiar with the code style (additionally, auto-formatter managed to sneak in some whitespace – ignore that.), so the implementation may not be the best. I'm fairly certain that I managed to re-implement it properly however.
Do note the change from using committer to author in the authored by message, as committer would be GitHub for any file edited in the web interface (but set to the appropriate info in the authored structure). Not sure if that string is used anywhere, but that seemed more correct.
I am trying to do some smarts here in how many pages of commits we retrieve, based on the commits the event listed as head and base (we could use those two fields to get the patch of the changeset, but then we couldn't filter author on a commit-by-commit basis
gh api -H "Accept: application/vnd.github.patch" /repos/oddstr13/github-profile-metrics/compare/c32878ca41906dba3e10fc9f19b2b12bc4298cd8...de58e40391d57e531a9e7330f7935d3637f85efd).This branch contain unrelated changes, mainly in the dockerfile, as this is my testing branch (and what is currently used to update my profile badge).
Closes #1753 as it only hides the exception
#1739 is related, in that it seems to be hiding the same issue in a different part of the code base, I have not looked into this yet, but that PR doesn't fix the underlying issue either, just hides it