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(platform/bitbucket): support reopening declined PRs via comments #22984

Merged
merged 11 commits into from Jul 2, 2023

Conversation

setchy
Copy link
Collaborator

@setchy setchy commented Jun 26, 2023

Changes

Adds Bitbucket Cloud specific handling for reopening declined PRs (system limitation prevents these being renamed or reopened)

Will look for any comments starting with reopen! on the declined PR.

Additionally, if the repository is also public, it will check that the commenter is a member of the Bitbucket workspace members

Context

Closes #14243

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@setchy
Copy link
Collaborator Author

setchy commented Jun 26, 2023

Demonstration repository: https://bitbucket.org/setchy87/demo-repo

@setchy setchy requested review from rarkins and viceice June 26, 2023 14:42
@setchy setchy added platform:bitbucket Bitbucket Cloud platform type:feature Feature (new functionality) labels Jun 26, 2023
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
@setchy setchy requested review from viceice and rarkins June 27, 2023 10:37
@rarkins
Copy link
Collaborator

rarkins commented Jun 27, 2023

Here's another idea - what about having the option to consider all users authorized if a repo is private? In such case you can pretty safely assume that someone who adds a comment to a PR is allowed to do so. It's only public repos where we want to avoid nuisance/spam

@setchy
Copy link
Collaborator Author

setchy commented Jun 27, 2023

Here's another idea - what about having the option to consider all users authorized if a repo is private? In such case you can pretty safely assume that someone who adds a comment to a PR is allowed to do so. It's only public repos where we want to avoid nuisance/spam

Let me recap to ensure I understand your thoughts

"is_private":true - Private Repository

  • any user may leave a reopen! comment

"is_private":false - Public Repository

  • (a) only from users who are effective reviewers (project config + repository config) for the repository (current impl)
  • (b) only from users who are a workspace member (not sure how feasible this is yet 🤔)

@setchy
Copy link
Collaborator Author

setchy commented Jun 27, 2023

Any preference on (a) or (b) @rarkins.

Looks like we can reuse the isAccountMemberOfWorkspace function to check workspace membership

@setchy
Copy link
Collaborator Author

setchy commented Jun 27, 2023

I've implemented (b) for public repositories - changes pushed 😄

@setchy setchy changed the title feat(platform/bitbucket): support reopening declined PRs via authorized user comments feat(platform/bitbucket): support reopening declined PRs via comments Jun 27, 2023
rarkins
rarkins previously approved these changes Jun 27, 2023
@setchy setchy self-assigned this Jun 30, 2023
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/utils.ts Outdated Show resolved Hide resolved
@setchy setchy requested a review from viceice July 2, 2023 09:35
@setchy setchy requested a review from rarkins July 2, 2023 09:35
@setchy setchy removed their assignment Jul 2, 2023
@rarkins rarkins added this pull request to the merge queue Jul 2, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 2, 2023
@rarkins rarkins added this pull request to the merge queue Jul 2, 2023
Merged via the queue into renovatebot:main with commit ed182aa Jul 2, 2023
36 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 35.158.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@setchy setchy deleted the feature/14243-bitbucket-declined-prs branch July 2, 2023 18:16
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform:bitbucket Bitbucket Cloud platform type:feature Feature (new functionality)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bitbucket Cloud: declined pull requests can neither be renamed not reopened
4 participants