Skip to content

Refactor GitHub.create_bump_pr#22014

Merged
MikeMcQuaid merged 2 commits into
mainfrom
refactor-create_bump_pr
Apr 14, 2026
Merged

Refactor GitHub.create_bump_pr#22014
MikeMcQuaid merged 2 commits into
mainfrom
refactor-create_bump_pr

Conversation

@Bo98
Copy link
Copy Markdown
Member

@Bo98 Bo98 commented Apr 14, 2026

  • Replace the T.untyped hash with typed structs
  • Remove the smell from passing args - instead take a few boolean kwargs that we need
  • Move out of utils/github as:
    • It was the odd one out in as everything else was a thin GitHub API wrapper while this was not
    • With all the extra structs it's fairly heavy and worth separating
    • Easier to include in requires we need without having to bloat utils/github

Note: brew-pip-audit needs to be updated to use the new internal API - https://github.com/Homebrew/brew-pip-audit/blob/e9516df15d36d5dec778d63fdc8fc875226613c6/generate-prs.rb#L234

I've not yet runtime tested this at all.

Copilot AI review requested due to automatic review settings April 14, 2026 03:29
Comment thread Library/Homebrew/dev-cmd/bump-formula-pr.rb Fixed
Comment thread Library/Homebrew/dev-cmd/bump-formula-pr.rb Fixed
Comment thread Library/Homebrew/dev-cmd/bump-formula-pr.rb Fixed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the bump PR creation flow by extracting it from GitHub.create_bump_pr into a dedicated internal Homebrew::Bump module using typed Sorbet structs, and updates bump commands to call the new API.

Changes:

  • Remove GitHub.create_bump_pr (and related helpers) from utils/github.rb.
  • Add Library/Homebrew/bump.rb implementing Homebrew::Bump.create_pr with typed BumpInfo / Commit structs.
  • Update bump-formula-pr and bump-cask-pr to construct typed inputs and call Homebrew::Bump.create_pr.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
Library/Homebrew/utils/github.rb Removes the old bump PR helper implementation from the GitHub utility module.
Library/Homebrew/dev-cmd/bump-formula-pr.rb Switches to Homebrew::Bump for PR creation and centralizes PR message construction.
Library/Homebrew/dev-cmd/bump-cask-pr.rb Switches to Homebrew::Bump for PR creation and adjusts remote repo handling / invariants.
Library/Homebrew/bump.rb Introduces the new typed internal implementation for creating bump PRs (fork/commit/push/open PR).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Library/Homebrew/bump.rb Outdated
Comment thread Library/Homebrew/bump.rb
Comment thread Library/Homebrew/dev-cmd/bump-cask-pr.rb Outdated
Comment thread Library/Homebrew/dev-cmd/bump-cask-pr.rb Outdated
@Bo98 Bo98 force-pushed the refactor-create_bump_pr branch from 154dc68 to 50300e8 Compare April 14, 2026 03:40
Copy link
Copy Markdown
Member

@dduugg dduugg left a comment

Choose a reason for hiding this comment

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

Nice extraction work! Just a couple light comments/questions.

Comment thread Library/Homebrew/dev-cmd/bump-cask-pr.rb Outdated
Comment thread Library/Homebrew/bump.rb
@Bo98 Bo98 force-pushed the refactor-create_bump_pr branch from 50300e8 to 4765741 Compare April 14, 2026 04:32
Comment thread Library/Homebrew/dev-cmd/bump-formula-pr.rb Dismissed
Comment thread Library/Homebrew/dev-cmd/bump-formula-pr.rb Dismissed
Comment thread Library/Homebrew/dev-cmd/bump-formula-pr.rb Dismissed
Comment thread Library/Homebrew/bump.rb Outdated
Copy link
Copy Markdown
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.

Nice work, thanks!

@MikeMcQuaid MikeMcQuaid enabled auto-merge April 14, 2026 07:38
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Apr 14, 2026
Merged via the queue into main with commit e03d55a Apr 14, 2026
36 checks passed
@MikeMcQuaid MikeMcQuaid deleted the refactor-create_bump_pr branch April 14, 2026 08:20
@botantony
Copy link
Copy Markdown
Member

I wonder if it caused uninitialized constant Homebrew::Bump::BumpInfo::Tap errors in the latest autobump workflow: https://github.com/Homebrew/homebrew-core/actions/runs/24395598194

botantony added a commit that referenced this pull request Apr 14, 2026
Now this code fails with `uninitialized constant` error, see
#22014 (comment)

Signed-off-by: botantony <antonsm21@gmail.com>
@botantony botantony mentioned this pull request Apr 14, 2026
6 tasks
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.

5 participants