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
Add closed PR check to bump cmds #14396
Add closed PR check to bump cmds #14396
Conversation
Currently we only check for closed PRs in `bump-cask-pr`. This adds that check to `bump` and `bump-formula-pr`. The idea is that this check can warn users about already updated packages or those that can't be updated easily and should be updated manually instead.
Review period will end on 2023-01-24 at 00:00:00 UTC. |
@@ -26,7 +26,7 @@ def bump_args | |||
switch "--cask", "--casks", | |||
description: "Check only casks." | |||
switch "--open-pr", | |||
description: "Open a pull request for the new version if there are none already open." | |||
description: "Open a pull request for the new version if none have been opened yet." |
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.
This is my attempt at clarifying that matching open or closed PRs will block you from opening another one. It's still probably too subtle though.
@@ -511,7 +511,7 @@ def check_for_duplicate_pull_requests(name, tap_remote_repo, state:, file:, args | |||
return if pull_requests.blank? | |||
|
|||
duplicates_message = <<~EOS | |||
These pull requests may be duplicates: | |||
These #{state} pull requests may be duplicates: |
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.
This is just nice to have.
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.
Very nice! Great work as usual @apainintheneck!
Review period skipped due to |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?This fixes #14336 where we found out that the
brew bump
command was failing when there already existed a closed PR that tried to update the package to the same version. This recommended passing the--force
flag which thebrew bump
command doesn't allow. This is expected behavior inbump-formula-pr
that wasn't addressed inbrew bump
. The change here is to check for closed PRs in thebrew bump
command first and not allow users to force any PRs from that command because it's a convenience command forbrew bump-cask-pr
andbrew bump-formula-pr
. It also adds the closed PR check tobrew bump-cask-pr
to match the formula version of the same command.The reason why we don't want people bumping packages that have a closed PR is because that means it was either already merged in or it requires some sort of extra attention that caused the bump to fail the first time.
One thing to keep in mind is that this will increase the number of times we query the Github API. Once more for
bump-cask-pr
and once more forbrew bump
. We could consider grabbing everything from the Github API and then splitting it into open and closed PRs inbrew bump
which would save an API request. The difference is that I think we would end up grabbing all of them meaning most of the data wouldn't be relevant to us (really old closed PRs). I'm not sure it's worth the effort (and I'm lazy).bump
It now checks for the closed PRs unless the user doesn't want us to hit the Github API (
--no-pull-requests
) or we've already found a matching open PR or a new version of the package isn't available.No matching PRs
Matching open PR
Matching closed PR
bump-cask-pr
It checks for closed PRs matching the version specified after checking for open ones.
Matching open PR
Matching closed PR