ci(macos): rewrite gz tap pin refresh in Ruby under brew ruby

The bash version spent most of its lines on plumbing: parsing a report
back out of a per-commit `brew ruby` child, awk and herestrings for set
logic, bash 3.2 workarounds, and a trap to restore the tap. The job
itself is small and lives inside Homebrew anyway, so run the whole thing
under Homebrew's Ruby and call its tap, formula and bottle APIs directly.

One process instead of one Homebrew startup per candidate commit, the
tap checkout restored by ensure, tarballs checked with Net::HTTP, and no
second language embedded in a string. Formulary.clear_cache and
Tap#clear_cache between checkouts keep each candidate's formulae fresh.
GITHUB_OUTPUT still arrives because brew forwards GITHUB_* whenever CI
is set. Same walk, same exemption for formulae unbottled at the pin,
same outputs; verified to pick the same commit as the bash version.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Ramon Roche
2026-09-04 11:58:38 -07:00
parent 2d6329fab2
commit 6f93287fdd
4 changed files with 196 additions and 190 deletions

View File

@@ -4,6 +4,6 @@
# dependency bump and rebuilds them days later. The tarballs stay on S3, so
# pinning keeps the install binary instead of compiling Gazebo from source.
# Move it to the newest commit where every gz formula macos.sh installs still
# carries a bottle block. Tools/ci/refresh_gz_tap_pin.sh does that, weekly
# carries a bottle block. Tools/ci/refresh_gz_tap_pin.rb does that, weekly
# from .github/workflows/macos_gz_tap_pin_refresh.yml or by hand.
43aee9cc6e02aa8b7327d0a8d3e895f93a99440f