Skip to content

Conversation

@oddstr13
Copy link

@oddstr13 oddstr13 commented Oct 17, 2025

⚠️ This is a working branch, and not intended for direct merging.
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;

 file:///metrics/source/app/action/index.mjs:15
  throw error
  ^

TypeError: Cannot destructure property 'committer' of 'undefined' as it is undefined.
    at file:///metrics/source/plugins/languages/analyzer/recent.mjs:70:21
    at Array.filter (<anonymous>)
    at RecentAnalyzer.patches (file:///metrics/source/plugins/languages/analyzer/recent.mjs:70:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async RecentAnalyzer.analyze (file:///metrics/source/plugins/languages/analyzer/recent.mjs:25:21)
    at async file:///metrics/source/plugins/languages/analyzer/recent.mjs:19:7
    at async results (file:///metrics/source/plugins/languages/analyzer/analyzer.mjs:63:7)

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 PushEvent no longer exists:

commits: [
{
sha: "MOCKED_SHA",
message: faker.lorem.sentence(),
url: "https://api.github.com/repos/lowlighter/metrics/commits/MOCKED_SHA",
author: {
email: faker.internet.email(),
},
},
],

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

@oddstr13 oddstr13 changed the title WIP: Fix recent languages after GitHub API change () WIP: Fix recent languages after GitHub API change (Cannot destructure property 'committer' of 'undefined') Oct 17, 2025
@fbuireu
Copy link

fbuireu commented Oct 22, 2025

Any updates on this? I'm also having the same issue @lowlighter

@oddstr13
Copy link
Author

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;
https://github.com/oddstr13/oddstr13/blob/a623f10b5933d3a011d7c2d210119c2cdb770f35/.github/workflows/metrics.yaml#L16-L18

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants