The flag used to work well, but at some point started to run more and
more git actions. We use this to update formula and casks in other
homebrew taps, and it works well except for this issue.
The default behaviour is too strict for unofficial taps. We can still
warn elsewhere but, given the potential for false positives, let's
loosen things a bit.
`brew bump-formula-pr` is encountering a type error, as the inferred
return type of `GitHub#check_for_duplicate_pull_requests` doesn't
align with the explicit return type of `#check_pull_requests`:
```
Error: Return value: Expected type T.nilable(T::Array[String]), got
type Module with value T::Private::Types::Void::VOID
Caller: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/
bump-formula-pr.rb:137
Definition: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/
dev-cmd/bump-formula-pr.rb:472 (Homebrew::DevCmd::BumpFormulaPr
#check_pull_requests)
```
This addresses the issue by adding a type signature with a `void`
return type to `#check_for_duplicate_pull_requests` and setting the
return type of `#check_pull_requests` to `void` as well. The return
type from `#check_pull_requests` isn't used, so a `void` return type
is arguably a better reflection of the method's behavior. The
`#check_pull_requests` method in `BumpCaskPr` has a `void` return
type, so this change brings the `BumpFormulaPr` method in line.
- change the messaging depending on how confident we are that we're
actually looking at duplicates i.e. we're not confident without a
version number supplied
- similarly, just warn instead of failing with an error (and no
override) if we're not confident that we're looking at duplicates
because a version wasn't supplied
- change `bump-cask-pr` and `bump-formula-pr` to always check for all
pull requests with the new version number (to allow failing on this)
rather than only checking closed pull requests with a version number
- change `bump` to check for definite/maybe duplicate PRs and only
exit if they are definitely duplicates
- cleanup some variable usage to DRY things up a bit
- This should fix https://github.com/Homebrew/homebrew-core/actions/runs/9839505520, that is:
```
Parameter 'tag': Expected type Float, got type String with value "2024-07-05"
Caller: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11473/lib/types/private/methods/call_validation.rb:215
Definition: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/bump-formula-pr.rb:445 (Homebrew::DevCmd::BumpFormulaPr#fetch_resource_and_forced_version)
```
- I think I read https://sorbet.org/docs/sigs#rest-parameters too literally,
yes Sorbet expands the kwargs into a hash type, but it's the value type that
needs specifying in the sig (which for us is `String`).
Don't let users open more than 15 PRs at a time. We have other tooling
to nudge them to not do this but let's put it in the worst offenders:
the `bump*` commands.
For now, restrict to partial version excluding the last part, i.e.
version with major.minor.patch will result in attempting to replace any
occurrences of "/#{major}.#{minor}/" or "/v#{major}.#{minor}/".
This should take care of common situations like GNOME, KDE, and
SourceForge URLs. It should also help with URLs like `util-linux`.
It may result in incorrect replacements if URL has partial version based
on another versioning scheme like the API version or if there are some
equivalent numbers in URL that happen to match
Signed-off-by: Michael Cho <michael@michaelcho.dev>
Instead output a message that corresponding formula/cask is on the
autobump list. This avoids deferring the information to the error
message within `bump-{formula,cask}-pr`.
Signed-off-by: Michael Cho <michael@michaelcho.dev>