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(bitbucket-cloud): Preserve Bitbucket Cloud reviewers when updating PRs #6560
Conversation
@@ -332,6 +332,7 @@ interface PrResponse { | |||
name: string; | |||
}; | |||
}; | |||
reviewers: Array<any>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we be more specific here? Looks like reviewers: {username: string}[]
might be more appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type returned here is a bit more complicated than that. It can return different fields, some that are populated and some that are not. I felt that a simple solution would be to put any
here since we don't really care what the values are, we just immediately return them to Bitbucket in the very next call.
Here's are links to the relevant API docs:
- Pull request response: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pullrequests/%7Bpull_request_id%7D
- User/account object: https://developer.atlassian.com/bitbucket/api/2/reference/resource/user
reviewers0..∞
The list of users that were added as reviewers on this pull request when it was created. For performance reasons, the API only includes this list on a pull request's self URL.
all of
object
Base type for most resource objects. It defines the common type element that identifies an object's type. It also identifies the element as Swagger's discriminator.
typestring
An account object.
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't care, we should use unknown
instead of any
Is this something that also needs to be fixed in Bitbucket server? |
@JamieMagee Should already be fixed in bb server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the types, otherwise LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ensure that the test case does test the new functionality and sends back the list of reviewers in the format required.
🎉 This PR is included in version 21.23.4 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This PR fixes an issue where Renovate will remove the reviewers associated with a Bitbucket Cloud PR when it interacts with it after creation. The issue here is that unless the reviewers are sent alongside the update request, they will be cleared away. The fix is to fetch the current list of reviewers and send them alongside any changes being made to the PR.
Closes #5772