MetaMask / MetaMask/auto-changelog

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

Open Beginner friendly
#297 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.