fix: gracefully handle unfetchable committer profiles in getCommitters - #76
fix: gracefully handle unfetchable committer profiles in getCommitters#76chirag3092 wants to merge 3 commits into
Conversation
|
@mansona, Hi, first-time contributor here. Could you approve the CI run when you get a chance? Fix + tests are in, and I've run lint/build/test locally, so it should be green. Happy to address any feedback. Thanks |
|
Thanks @chirag3092 for the contribution! So I would love to know more about this change 🤔 the code change makes sense on the face of it but I wonder what it will looking like in the acual changelog with this information missing? your tests only updated the unit style tests so I can't see an output Markdown from this change |
|
@mansona Good point: the unit tests didn't show the actual output. Also found the fallback could render a broken empty-href link, so I fixed that too: it now falls back to a plain Added a functional test that runs the real Let me know if you'd like anything else! |
|
Hey @mansona, just checking in on this one. I've addressed your feedback (functional test showing actual markdown output + the empty-href fix). Let me know if there's anything else you'd like adjusted or if this is good to merge. |
Problem
getCommitterscallsgetUserDatafor every PR author to fetch their profile. If that request fails (e.g. 403 for bot accounts where the token lacks sufficient scope, or 404 for deleted accounts), the entire changelog generation throws and therelease-plan preparecommand fails.Solution
Wrap the
getUserDatacall in a try/catch. On failure, fall back to a minimal contributor entry using theloginandhtml_urlalready available from the PR issue data, so changelog generation continues rather than crashing.The fallback renders as
[@login](html_url)when a usablehtml_urlis available (e.g. most bot accounts) and as a plain@loginmention when it isn't (e.g. deleted accounts), accurate for both cases without fabricating any data or producing a broken empty-href link.Test cases added
getCommittersfor 403 (restricted bot), 404 (deleted account), missinghtml_url, andignoreCommittersinteractionrenderContributorfor both the linked and plain-mention branchesrenderContributorListsnapshot showing a fallback contributor mixed with a full contributormarkdown-unfetchable-comitter.spec.js) that runs the realcreateMarkdown()pipeline end-to-end, showing the actual generated changelog with one normal committer and one unfetchable bot committer side by side