Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Add relevant reviewers to PRs to local BitBucket repositories instead of everyone in the Project #1108

Conversation

arikalish
Copy link
Contributor

✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)

Bug fix? I guess?

⤵️ What is the current behavior?

When creating a PR to a locally-hosted BitBucket repository everyone set as a default reviewer in the Project, including users that no longer exist, are added as reviewers.

This results in people who don't need to see the PRs being added to them erroneously.

Also, default reviewer rules are not respected, so folks that should be put on PRs are not added.

If a user no longer exists NuKeeper fails due to the presence of an error section in the response, even though BitBucket also provides a list of users.

For reference, repositories live inside of projects in BB, so we might have:

Project X

  • Repo

If Project X has reviewers:
A: All branches
B: Branches named "foo-"
C: Branches named "bar-
"
Repo:
D: "foo-*"

Example cases:

PR of branch "abc" into Repo:
Users A, B, and C will be added to the PR but user D will not be.
Expected behavior in that case would be for user A to be added and no one else.

PR of branch "foo-123" into Repo:
Users A, B, and C will be added to the PR but user D will not be.
Expected behavior: Users A, B, and D are added.

PR of branch "bar-456" into Repo:
Users A, B, and C will be added to the PR but user D will not be.
Expected behavior: Users A and B are added.

🆕 What is the new behavior (if this is a feature change)?

Call the default reviewers API on the BitBucket instance to get the list of expected reviewers from BitBucket itself and filter out any inactive (aka: deleted) users that might have been left in rules on the server. BitBucket will apply the rules that would be applied if a user had created the PR manually.

💥 Does this PR introduce a breaking change?

Yes, but the existing behavior was likely not what was intended

🐛 Recommendations for testing

See above example cases, also test with users that have been removed from BitBucket but are still present in default reviewer rules.

📝 Links to relevant issues/docs

N/A

🤔 Checklist before submitting

  • All projects build
  • Relevant documentation was updated

@stale
Copy link

stale bot commented Aug 11, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Aug 11, 2021
@arikalish
Copy link
Contributor Author

Still relevant

@stale stale bot removed the wontfix label Aug 16, 2021
@skolima
Copy link
Collaborator

skolima commented Sep 20, 2021

Looks good. Thanks.

@skolima skolima merged commit 39bdcd5 into NuKeeperDotNet:master Sep 20, 2021
@arikalish arikalish deleted the AddRelevantReviewersToLocalBitBucketPRs branch September 20, 2021 17:33
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.

None yet

2 participants