Skip to content

feat: add reviewers parameter to UpdatePullRequest #285

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

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

Conversation

MayorFaj
Copy link
Contributor

This pull request introduces the ability to request reviewers when updating a pull request. The changes include updates to the UpdatePullRequest function to handle reviewers, modifications to the test cases to cover the new functionality, and updates to the documentation.

Enhancements to UpdatePullRequest function:

  • Added support for specifying GitHub usernames to request reviews from in the UpdatePullRequest function. (pkg/github/pullrequests.go) [1] [2] [3]
  • Ensured the function handles cases where no update is needed but reviewers are specified. (pkg/github/pullrequests.go)

Documentation updates:

  • Updated README.md to include the new reviewers parameter in the documentation for updating pull requests. (README.md)

Test case updates:

  • Added new test cases to cover scenarios with reviewers, including successful updates and failure cases. (pkg/github/pullrequests_test.go) [1] [2] [3] [4] [5]

updatereview

Closes: #259

@Copilot Copilot AI review requested due to automatic review settings April 15, 2025 23:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

@MayorFaj MayorFaj requested a review from a team as a code owner April 17, 2025 11:26
@MayorFaj MayorFaj changed the title feat: add reviewers parameter to UpdatePullRequest and update tests feat: add reviewers parameter to UpdatePullRequest Apr 19, 2025
JoannaaKL
JoannaaKL previously approved these changes Jun 24, 2025
@JoannaaKL
Copy link
Contributor

Hi @MayorFaj, can you please update the pr so we can get it merged? :)

@MayorFaj MayorFaj requested a review from JoannaaKL June 25, 2025 20:48
@MayorFaj
Copy link
Contributor Author

MayorFaj commented Jul 7, 2025

@JoannaaKL the PR has been updated

@deivyrene
Copy link

@JoannaaKL the PR has been updated

Could you update again because is out-of-date? Great PR!

}

// If no updates and no reviewers, return error
if !updateNeeded && len(reviewers) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this check before the line 316?

} else {
// If no update needed, just get the current PR
var ghResp *github.Response
pr, ghResp, err = client.PullRequests.Get(ctx, owner, repo, pullNumber)
Copy link
Contributor

Choose a reason for hiding this comment

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

We we need this else? If no updates are needed and no new reviewers were requested we will just return an error (please see comment below).

Copy link
Contributor

@JoannaaKL JoannaaKL left a comment

Choose a reason for hiding this comment

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

Looks good! I'd update the part where we're fetching the pull request - I don't think we need that :)

@MayorFaj MayorFaj requested a review from JoannaaKL July 25, 2025 13:54
mattdholloway and others added 6 commits July 29, 2025 19:07
* initial impl of pull request draft state update

* appease linter

* update README

* add nosec

* fixed err return type for json marshalling

* add gql test
…b#775)

* make repo optional, and default to .github when not provided. improve tool description

* autogen

* update tests

* small copy paste error fixes
@MayorFaj
Copy link
Contributor Author

@JoannaaKL , if you get the chance could you please review this PR again so it can be merged asap. Has changes get merged to main, I am having to resolve conflicts, which is time consuming

Copy link
Contributor

@mattdholloway mattdholloway left a comment

Choose a reason for hiding this comment

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

Mostly looks good, just a few changes in reference to the recent draft updates to the PR tool

Comment on lines +618 to +633
if tc.expectedPR.Title != nil {
assert.Equal(t, *tc.expectedPR.Title, *returnedPR.Title)
}
if tc.expectedPR.Body != nil {
assert.Equal(t, *tc.expectedPR.Body, *returnedPR.Body)
}
if tc.expectedPR.State != nil {
assert.Equal(t, *tc.expectedPR.State, *returnedPR.State)
}
if tc.expectedPR.Base != nil && tc.expectedPR.Base.Ref != nil {
assert.NotNil(t, returnedPR.Base)
assert.Equal(t, *tc.expectedPR.Base.Ref, *returnedPR.Base.Ref)
}
if tc.expectedPR.MaintainerCanModify != nil {
assert.Equal(t, *tc.expectedPR.MaintainerCanModify, *returnedPR.MaintainerCanModify)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is out of scope for this PR

Comment on lines +342 to +345
mock.WithRequestMatch(
mock.GetReposPullsByOwnerByRepoByPullNumber,
mockNoUpdatePR,
),
Copy link
Contributor

Choose a reason for hiding this comment

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

Getting the PR here is not needed

Comment on lines +178 to +182
mockNoUpdatePR := &github.PullRequest{
Number: github.Ptr(42),
Title: github.Ptr("Test PR"),
State: github.Ptr("open"),
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be removed as well due to the referencing test not being required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add functionality to assign reviewers to pull requests
5 participants