Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing/wrong pull requests for commits #436

Open
orhun opened this issue Jan 5, 2024 · 3 comments · May be fixed by #831
Open

Missing/wrong pull requests for commits #436

orhun opened this issue Jan 5, 2024 · 3 comments · May be fixed by #831
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed integration Related to GitHub/GitLab integration

Comments

@orhun
Copy link
Owner

orhun commented Jan 5, 2024

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.

@orhun orhun added bug Something isn't working help wanted Extra attention is needed integration Related to GitHub/GitLab integration labels Jan 5, 2024
@orhun orhun self-assigned this Jan 5, 2024
@dark0dave
Copy link
Contributor

We need to change the logic to get the user from the pr, not from the commit, get the pr number from the commit should be straightforward.

@dark0dave
Copy link
Contributor

    "number": 1347,
    "state": "open",
    "locked": true,
    "title": "Amazing new feature",
    "user": {
      "login": "octocat",

https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests

@orhun orhun linked a pull request Sep 1, 2024 that will close this issue
12 tasks
@orhun
Copy link
Owner Author

orhun commented Sep 1, 2024

That actually makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed integration Related to GitHub/GitLab integration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants