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

fix: associated pull requests should match merge commit sha #817

Merged
merged 3 commits into from Mar 9, 2021

Conversation

chingor13
Copy link
Contributor

@chingor13 chingor13 commented Mar 9, 2021

This should fix some misidentified release PRs. Sometimes, multiple pull requests are associated with a commit. In those cases, match the merge commit sha against the commit sha to find the pull request that made that commit.

Fixes #818

@chingor13 chingor13 requested a review from a team as a code owner March 9, 2021 21:43
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Mar 9, 2021
@codecov
Copy link

codecov bot commented Mar 9, 2021

Codecov Report

Merging #817 (878026f) into master (89e5bed) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #817   +/-   ##
=======================================
  Coverage   93.56%   93.56%           
=======================================
  Files          64       64           
  Lines        8870     8880   +10     
  Branches      930      883   -47     
=======================================
+ Hits         8299     8309   +10     
  Misses        568      568           
  Partials        3        3           
Impacted Files Coverage Δ
src/github.ts 89.60% <100.00%> (+0.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89e5bed...878026f. Read the comment docs.

@chingor13
Copy link
Contributor Author

cc @kolea2

Comment on lines +710 to +715
const pullRequest = graphCommit.associatedPullRequests.nodes.find(
pr => {
return pr.mergeCommit && pr.mergeCommit.oid === graphCommit.sha;
}
);
if (pullRequest) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense though I'd be curious to understand better what a pr.mergeCommit.oid is in different cases of how the PR could have been merged (e.g. traditional "create a merge commit", vs "squash", vs "rebase"). I guess whatever the PR-Merge strategy, this logic will find the PR that literally is the reason for this graphCommit.sha/pr.mergeCommit.oid to exist in the history of the branch at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example responses:

@bcoe bcoe merged commit c144f8b into googleapis:master Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

latestTag can report the wrong version number
3 participants