build: gate brew commands in free-space-macos action (#49123)

fix: gate brew commands in free-space-macos action

The brew uninstall and autoremove commands now only run if
brew is available on the machine. This prevents failures on
runners where Homebrew is not installed.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Samuel Attard
2025-12-01 17:32:46 -08:00
committed by GitHub
parent 7aafe66717
commit 8ce97df569

View File

@@ -80,8 +80,10 @@ runs:
sudo rm -rf /Users/runner/.rustup
# remove homebrew packages we don't need
brew uninstall -f --zap aws-sam-cli session-manager-plugin gcc gcc@13 gcc@14 llvm@18 gradle maven ant azure-cli
brew autoremove
if command -v brew &> /dev/null; then
brew uninstall -f --zap aws-sam-cli session-manager-plugin gcc gcc@13 gcc@14 llvm@18 gradle maven ant azure-cli
brew autoremove
fi
# lipo off some huge binaries arm64 versions to save space
strip_universal_deep $(xcode-select -p)/../SharedFrameworks