MetaMask / MetaMask/auto-changelog
parseChangelog misses PR links when repoUrl has a trailing .git suffix
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
What happened?
parseChangelog({ shouldExtractPrLinks: true }) fails to extract long-form PR links when the repoUrl argument includes a trailing .git suffix.
That suffix is common in package.json repository URLs, including this package's own repository metadata:
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/auto-changelog.git"
}
The parser derives repoName with extractRepoName(repoUrl), then embeds that value in the regex used to match PR links. Today, extractRepoName('https://github.com/MetaMask/auto-changelog.git') returns auto-changelog.git, but real GitHub PR URLs are shaped like /MetaMask/auto-changelog/pull/123, without .git. As a result, valid PR links are silently ignored.
Minimal reproduction
const changelog = parseChangelog({
changelogContent: `# Changelog
## [Unreleased]
## [1.0.0]
### Changed
- Fix something ([#123](https://github.com/MetaMask/auto-changelog/pull/123))
[Unreleased]: https://github.com/MetaMask/auto-changelog/compare/v1.0.0...HEAD
[1.0.0]: https://github.com/MetaMask/auto-changelog/releases/tag/v1.0.0`,
repoUrl: 'https://github.com/MetaMask/auto-changelog.git',
shouldExtractPrLinks: true,
});
changelog.getReleaseChanges('1.0.0');
Expected: the change has prNumbers: ['123'] and the description no longer includes the PR link.
Actual: the PR link is left in the description and prNumbers is empty.
Suggested fix
Strip an optional trailing .git inside extractRepoName() itself, instead of relying on all callers to normalize repoUrl before calling parseChangelog().
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading extractRepoName() and how parseChangelog() uses its result to build the PR-link matcher. Reproduce the provided example with a repoUrl ending in .git; done means the optional suffix is handled and the change yields prNumbers ['123'] while removing the PR link from the description.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100