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(bitbucket-cloud): Preserve Bitbucket Cloud reviewers when updating PRs #6560

Merged
merged 1 commit into from Jul 6, 2020

Conversation

daekene
Copy link
Contributor

@daekene daekene commented Jun 22, 2020

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

@@ -332,6 +332,7 @@ interface PrResponse {
name: string;
};
};
reviewers: Array<any>;
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 be more specific here? Looks like reviewers: {username: string}[] might be more appropriate.

Copy link
Contributor Author

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:

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.
...

Copy link
Member

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

@JamieMagee
Copy link
Contributor

Is this something that also needs to be fixed in Bitbucket server?

@JamieMagee JamieMagee requested a review from viceice June 22, 2020 08:58
@viceice
Copy link
Member

viceice commented Jun 22, 2020

@JamieMagee Should already be fixed in bb server.

Copy link
Member

@viceice viceice left a 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

Copy link
Collaborator

@rarkins rarkins left a 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.

lib/platform/bitbucket/index.spec.ts Show resolved Hide resolved
@rarkins rarkins merged commit e015875 into renovatebot:master Jul 6, 2020
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 21.23.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] bb-cloud: changing reviewers leads to changed body
5 participants