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

bump: skip PR checking when up to date or livecheck fails #18812

Merged
merged 3 commits into from
Nov 25, 2024

Conversation

samford
Copy link
Member

@samford samford commented Nov 24, 2024

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

brew bump will check for PRs related to a package even if the package version and livecheck version are the same. We're presumably only interested in related PRs when the livecheck version differs, so we can reduce GitHub API requests by skipping the check(s) when the versions are equal. We use bump in autobump workflows, so this should help with recent rate limiting issues (e.g., 3,203 out of 3,266 autobumped formulae were up to date in a recent run but bump still checked them for duplicate PRs).

This also reworks the output for duplicate PRs, making it clear when bump skipped checking PRs (as printing "none" would suggest that PRs were checked) and only printing the "Maybe duplicate" information when checked. This makes it a little easier to understand what bump has done internally from the output.

Lastly, this expands test coverage for BumpVersionParser, bringing line coverage to 100% and branch coverage to 95.45%. This is the best we can do for branch coverage, as Sorbet will catch an invalid argument type before the #parse_version method is executed, so we can't exercise the method in a test to get 100% coverage.

@samford samford force-pushed the bump-skip-pr-checking-when-up-to-date branch from 0137f2e to 2ccded4 Compare November 24, 2024 16:56
Library/Homebrew/test/bump_version_parser_spec.rb Outdated Show resolved Hide resolved
Library/Homebrew/dev-cmd/bump.rb Outdated Show resolved Hide resolved
Library/Homebrew/dev-cmd/bump.rb Outdated Show resolved Hide resolved
`brew bump` will check for PRs related to a package even if the
package version and livecheck version are the same. We're presumably
only interested in related PRs when the livecheck version differs, so
we can reduce GitHub API requests by skipping the check(s) when the
versions are equal. We use `bump` in `autobump` workflows, so this
should help with recent rate limiting issues (e.g., 3203 out of 3426
autobumped formulae were up to date in a recent run).

This also reworks the output for duplicate PRs, making it clear when
`bump` skipped checking PRs (as printing "none" would suggest that
PRs were checked) and only printing the "Maybe duplicate" information
when checked. This makes it a little easier to understand what `bump`
has done internally from the output.
This expands test coverage for `BumpVersionParser`, bringing line
coverage to 100% and branch coverage to 95.45%. This is the best we
can do for branch coverage, as Sorbet will catch an invalid argument
type before the method is executed, so we can't exercise the method
in a test to get 100% coverage.
`brew bump` will check for PRs related to a package even if livecheck
fails to identify new versions. This reworks related conditions to
ensure that related PR checks are only run when livecheck returns
version information.
@samford samford force-pushed the bump-skip-pr-checking-when-up-to-date branch from 2ccded4 to 1cbcc44 Compare November 25, 2024 02:15
@samford
Copy link
Member Author

samford commented Nov 25, 2024

While tinkering with this some more, I noticed that bump will also check for related PRs even if livecheck fails to return version information. I've updated this to also avoid checking for PRs in this situation, as we don't need to check for duplicate version bump PRs when we don't know the latest upstream version.

@samford samford changed the title bump: skip PR checking when up to date bump: skip PR checking when up to date or livecheck fails Nov 25, 2024
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @samford! Left some comments but for a follow-up PR as feels important to merge this as-is for now to help our rate limits.

Maybe duplicate pull requests: #{maybe_duplicate_pull_requests || "none"}
EOS
if !args.no_pull_requests? &&
(new_version.general != "unable to get versions") &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to extract unable to get versions (and, from below, none) into constants.

@MikeMcQuaid MikeMcQuaid merged commit 4a77cd1 into master Nov 25, 2024
28 checks passed
@MikeMcQuaid MikeMcQuaid deleted the bump-skip-pr-checking-when-up-to-date branch November 25, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants