Skip to content
This repository was archived by the owner on Oct 22, 2026. It is now read-only.

fix(parse-changelog): strip trailing .git from repo names - #298

Open
omerbek wants to merge 2 commits into
MetaMask:mainfrom
omerbek:fix/extract-repo-name-strip-git-suffix
Open

omerbek wants to merge 2 commits into
MetaMask:mainfrom
omerbek:fix/extract-repo-name-strip-git-suffix

Conversation

@omerbek

@omerbek omerbek commented Aug 25, 2026 •

Copy link
Copy Markdown

Summary

  • Strip an optional trailing .git suffix when deriving the repository name for changelog PR-link extraction
  • Add a regression test covering parseChangelog({ shouldExtractPrLinks: true }) with a .git-suffixed repoUrl

Fixes MetaMask/release-tools#126.

Testing

  • ./node_modules/.bin/eslint.cmd src/parse-changelog.ts src/parse-changelog.test.ts
  • ./node_modules/.bin/jest.cmd --runInBand

Note: running only parse-changelog.test.ts passes all 50 tests in that file, but exits non-zero because this repo enforces global coverage thresholds across the full suite.


Note

Low Risk
Small, localized parsing fix with a dedicated test; no auth, security, or broad API surface changes.

Overview
Fixes PR link extraction and round-tripping when parseChangelog is given a GitHub repoUrl that ends with .git (common for clone URLs).

parseChangelog now strips an optional trailing .git before building the Changelog and deriving the repo name used to match [#N](.../pull/N) links. extractRepoName was updated so the captured name does not include .git.

A regression test asserts that with shouldExtractPrLinks: true, PR numbers are extracted from a .git-suffixed URL and toString() emits normal /pull/ links without .git in the path.

Reviewed by Cursor Bugbot for commit 22c0509. Bugbot is set up for automated code reviews on this repo. Configure here.

@omerbek
omerbek requested a review from a team as a code owner August 25, 2026 07:13

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit e92c766. Configure here.

Comment thread src/parse-changelog.ts Resolved
Comment thread src/parse-changelog.ts
shouldExtractPrLinks?: boolean;
}) {
const changelogLines = changelogContent.split(/(?:\r)?\n/u); // Split on either Windows or Unix line endings
const normalizedRepoUrl = repoUrl.replace(/\.git$/u, '');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@omerbek Thanks for the suggestion.

parseChangelog does not make any assumption about what the repo URL is. So if you are calling this function on its own, or you're running auto-changelog and passing --repo, or you're calling validateChangelog or updateChangelog, then at each step you can pass whatever repo URL you want. And by default, the repo URL will be retrieved from package.json via readRepositoryUrlFromPackageJson, which already normalizes the URL.

So I'm not 100% sure why this would be necessary, but perhaps there's something I'm not seeing. Would you be willing to share how you are using this package?

@MetaMask MetaMask locked and limited conversation to collaborators Oct 22, 2026
@GuillaumeRx

Copy link
Copy Markdown
Contributor

This library has now been migrated into the release-tools monorepo. This PR has been locked and this repo will be archived shortly. Going forward, releases of this library will only include changes made in the release-tools repo.

  • Please push this branch to release-tools and open a new PR there.
  • Optionally, add a link pointing to the discussion in this PR to provide context.

This branch has not been deployed

No deployments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parseChangelog misses PR links when repoUrl has a trailing .git suffix

3 participants