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 committed 2026-09-04 13:26:30 -07:00
1 parent 2d6329fab2
commit 6f93287fdd
4 files changed
+196 -190

No files matched your search

@@ -4,8 +4,8 @@ name: macOS - Refresh gz tap pin
# --sim-tools pours Gazebo bottles instead of compiling them (see that file).
# OSRF advances the tap several times a week, so once a week this moves the
# pin to the newest commit whose Gazebo formulae are all bottled and opens a
# PR for it. Tools/ci/refresh_gz_tap_pin.sh does the work and can be run by
# hand on any Mac.
# PR for it. Tools/ci/refresh_gz_tap_pin.rb does the work under Homebrew's
# Ruby and can be run by hand on any Mac.
on:
schedule:
@@ -26,7 +26,7 @@ jobs:
- name: Find the newest fully bottled osrf/simulation commit
id: pin
run: ./Tools/ci/refresh_gz_tap_pin.sh
run: brew ruby Tools/ci/refresh_gz_tap_pin.rb
- name: Open PR with the new pin
if: steps.pin.outputs.needs_bump == 'true'