Skip to content

fix: gracefully handle unfetchable committer profiles in getCommitters - #76

Open
chirag3092 wants to merge 3 commits into
release-plan:mainfrom
chirag3092:fix/gracefull-bot-commiter-fetch
Open

fix: gracefully handle unfetchable committer profiles in getCommitters#76
chirag3092 wants to merge 3 commits into
release-plan:mainfrom
chirag3092:fix/gracefull-bot-commiter-fetch

Conversation

@chirag3092

@chirag3092 chirag3092 commented Jul 2, 2026

Copy link
Copy Markdown

Problem

getCommitters calls getUserData for 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 the release-plan prepare command fails.

Solution

Wrap the getUserData call in a try/catch. On failure, fall back to a minimal contributor entry using the login and html_url already available from the PR issue data, so changelog generation continues rather than crashing.

The fallback renders as [@login](html_url) when a usable html_url is available (e.g. most bot accounts) and as a plain @login mention 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

  • Unit tests on getCommitters for 403 (restricted bot), 404 (deleted account), missing html_url, and ignoreCommitters interaction
  • Unit tests on renderContributor for both the linked and plain-mention branches
  • A renderContributorList snapshot showing a fallback contributor mixed with a full contributor
  • A functional test (markdown-unfetchable-comitter.spec.js) that runs the real createMarkdown() pipeline end-to-end, showing the actual generated changelog with one normal committer and one unfetchable bot committer side by side

@chirag3092

Copy link
Copy Markdown
Author

@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

@mansona

mansona commented Jul 3, 2026

Copy link
Copy Markdown
Member

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

@chirag3092

Copy link
Copy Markdown
Author

@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 @login mention when html_url isn't available, and to a real [@login](html_url) link when it is.

Added a functional test that runs the real createMarkdown() pipeline end-to-end with one normal committer and one unfetchable bot committer so that you can see the actual generated changelog output rather than just the unit-level return values.

Let me know if you'd like anything else!

@chirag3092

Copy link
Copy Markdown
Author

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.
Happy to iterate further. Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants