fix!: make CommitAuthor email nullable #799
Merged
+14
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR issue
Currently JSON parsing breaks when handling Push Webhook events where the pusher is a bot without an email.
Description
Currently, the Push webhook uses the
GitUserTime(which internally use the flattenCommitAuthor) as thePusher, which assumes that email is always present. After considering adding a new struct to represent thePusher, I noticed that in the documentation it mentions that the email can be null for all theCommiter,PusherandAuthor.This was noticed while handling Push webhook events from GitHub Merge Queue, where the pusher is:
But also investigated and this seems to be the case for bots in general. As PRs where the pushes are done by Renovate also have the pusher as:
So, because of that, the suggestion here is to do the change directly on the
CommitAuthor. This approach is a breaking change for the current API. Another solution if we want to avoid it being breaking would be to have a different type for thePusherwhere the email is nullable/optional.Screenshots
References