-
Notifications
You must be signed in to change notification settings - Fork 242
Description
There are certain scenarios where undefined links pop up in the README activity feed. For instance, here are some examples from my own profile:
- jamesgeorge007/jamesgeorge007@bfe0205
- jamesgeorge007/jamesgeorge007@8fef17a
- jamesgeorge007/jamesgeorge007@8823462
In these commits, you can see entries like:
❌ Assigned PR [#5485](undefined)❌ Labeled PR [#5425](undefined)❌ Closed PR [#5451](undefined)
The Problem:
The serializers for PullRequestEvent and IssuesEvent only handle a small subset of GitHub's event actions:
-
PullRequestEvent: Only checks for
openedand merged state.github-activity-readme/index.js
Lines 158 to 164 in 76c2edb
PullRequestEvent: (item) => { const emoji = item.payload.action === "opened" ? "💪" : "❌"; const line = item.payload.pull_request.merged ? "🎉 Merged" : `${emoji} ${capitalize(item.payload.action)}`; return `${line} PR ${toUrlFormat(item)} in ${toUrlFormat(item.repo.name)}`; }, -
IssuesEvent: Only handles
opened,reopened, andclosedgithub-activity-readme/index.js
Lines 139 to 157 in 76c2edb
IssuesEvent: (item) => { let emoji = ""; switch (item.payload.action) { case "opened": emoji = "❗"; break; case "reopened": emoji = "🔓"; break; case "closed": emoji = "🔒"; break; } return `${emoji} ${capitalize(item.payload.action)} issue ${toUrlFormat( item, )} in ${toUrlFormat(item.repo.name)}`; },
When other actions happen (like assigning, labelling, requesting reviews), the events still get processed, but end up with undefined URLs because we're not handling those action types properly.
What needs to be done:
This is a good opportunity for anyone looking to contribute! Here's the plan:
-
Extend
PullRequestEventserializer to handle:assigned/unassignedlabelled/unlabeledreview_requested/review_request_removedclosed(as distinct from merged)edited
-
Extend
IssuesEventserializer for:assigned/unassignedlabelled/unlabeled- Maybe also
pinned,locked,transferred, etc.
-
Add graceful fallback - Either filter out unrecognised actions or show them with a generic format instead of producing broken output
Technical details:
- The action type is in
item.payload.action toUrlFormat()already works fine when the payload has the right properties- Check GitHub's event docs for the full list: https://docs.github.com/en/rest/activity/events
Acceptance criteria:
- No more
undefinedURLs in activity output - Common PR actions display with appropriate emojis and formatting
- Common issue actions display with appropriate emojis and formatting
- Unhandled actions either filtered out or shown with fallback format
- Consistent with existing message style
Most of the work will be in the serializers object starting around index.js:133. Pick emojis that make sense and keep the messages concise!
If you want to take this on, drop a comment, and I'm happy to help out as you work through it.