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

feat(api): add commit fields to access authors and PR number #1717

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chachako
Copy link

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #1716

@chachako chachako requested a review from a team as a code owner October 21, 2022 09:29
@chachako chachako requested a review from a team October 21, 2022 09:29
@product-auto-label product-auto-label bot added the size: xl Pull request size is extra large. label Oct 21, 2022
Copy link
Contributor

@chingor13 chingor13 left a comment

Choose a reason for hiding this comment

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

Thanks for this! One comment about the behavior of associated pull requests, otherwise this feature looks good.

Comment on lines +519 to +525
associatedPRs.forEach(pr => {
pr.commits.nodes.forEach(node => {
node.commit.authors.nodes
.map(author => author.name)
.forEach(authors.add, authors);
});
});
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will grab authors that are not necessarily intended. Associated pull requests include any PRs that are mentioned in the commit message, not necessarily the PR that created it.

So if we mention another PR by another author, this will grab that PR's author who should not necessarily be attached to the current PR.

This weird behavior is why we have that logic to find the associated pull request whose merge commit SHA matches the commit SHA (skip the mentioned PRs)

Copy link
Author

Choose a reason for hiding this comment

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

I'm a little puzzled, and I'm a little curious about what scenario this will happen in. Can you tell me how to trigger this problem?

Copy link
Contributor

Choose a reason for hiding this comment

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

If you reference another PR in the PR body like See #1234, then graphql will return that as an associatedPullRequest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add commit fields to access authors and PR number
2 participants