orhun/git-cliff

Missing/wrong pull requests for commits

Offen

#436 geöffnet am 05.01.2024

 (3 Kommentare) (0 Reaktionen) (1 zugewiesene Person)Rust (308 Forks)auto 404
bughelp wantedintegration

Repository-Metriken

Stars
 (12.040 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Describe the issue

The current approach to associate commits with the pull requests is the following:

  1. Fetch the commits.
  2. Fetch the pull requests.
  3. Check if the merge_commit_sha of the pull request matches the SHA of the commit.
github_commits.for_each(|commit| {
		let pull_request = github_pull_requests
			.iter()
			.find(|pr| pr.merge_commit_sha == Some(commit.sha.clone()));
    });

This poses a couple of problems when the pull request is not squashed but rebased.

Take #360 for example (it is rebased). git cliff -c github outputs:

* fix: allow version bump with a single previous release by @orhun in #360
* fix: allow version bump with a single previous release by @nappa85

However, it should be:

* fix: allow version bump with a single previous release by @nappa85 in #360

Additional context

I don't know how to fix this yet since it is the limitation of the data we get from the GitHub API. In the perfect world, /commits endpoint would also return the associated pull request number so that we don't need to fetch the pull requests and do some hacky comparison.

Alternatively, we could use <commit>/pull API but that just means sending a request for each commit which adds up to a lot.

Contributor Guide