plugin_habits crashes with TypeError when payload.commits is null (private repositories) #1813
Unanswered
AnalogicMindset
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
plugin_habitsthrows aTypeErrorwhen used by accounts whose activity is primarily on private repositories.Error
Root cause
In
source/plugins/habits/index.mjs, the following chain:GitHub's Events API omits
payload.commits(returnsnullorundefined) for push events on private repositories, even when using an authenticated token with full repo scope.This causes
flatMapto produceundefinedelements, which the subsequent.filter(({author}) => ...)cannot destructure.I verified this by inspecting 300 events via the GitHub API: out of 171
PushEvententries, the vast majority hadpayload.commits === null, and all of them belonged to private repositories.Suggested fix
Change line ~51 from:
to:
This makes the plugin skip push events with no commit data instead of crashing.
Configuration used
Environment
3.34.0)Beta Was this translation helpful? Give feedback.
All reactions