Skip to content

fix: use graph-based compare instead of timestamp when from-tag-name is set #316

@miroslavpojer

Description

@miroslavpojer

Problem

When generating release notes for a maintenance branch (e.g. v2.6.x) that runs in parallel with a development branch (v2.7.x), the current timestamp-based commit fetch (repo.get_commits(since=…)) returns commits from all branches in the time window. This causes unrelated develop-branch PRs to appear in the maintenance patch release notes.

Solution

When from-tag-name is explicitly provided, switch to the GitHub Compare API (repo.compare(from_tag, to_tag)). This returns only commits reachable from tag-name but not from from-tag-name, regardless of timestamps or branches — identical to running:

git log --oneline --right-only --cherry-pick <from-tag>...<to-tag>

PR numbers are extracted from the returned commit messages and fetched individually. The existing timestamp path is unchanged when from-tag-name is not set.

Files affected

  • release_notes_generator/model/mined_data.py — add compare_commit_shas: set[str]
  • release_notes_generator/data/miner.py — add compare-mode branch and _extract_pr_numbers_from_commits helper
  • release_notes_generator/data/filter.py — skip timestamp filter when compare_commit_shas is non-empty

Metadata

Metadata

Assignees

Labels

No labels
No labels
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions