fix(release): use find instead of bash-4 globstar in artifact collection#8
fix(release): use find instead of bash-4 globstar in artifact collection#8gocanto wants to merge 1 commit into
Conversation
macOS GitHub runners ship bash 3.2, which lacks `globstar`, so the
`shopt -s globstar` + `**` recursive globs in collect-release-artifacts.sh
errored ('shopt: globstar: invalid shell option name') and failed the
release before publishing. Replace the recursive globs with `find`, which
works on bash 3.2.
There was a problem hiding this comment.
Code Review
This pull request replaces the use of bash globstar (**) with find in collect-release-artifacts.sh to ensure compatibility with macOS GitHub runners running bash 3.2. Feedback was provided regarding the use of find ... | head -n1 in combination with set -euo pipefail, which can cause the script to crash unexpectedly due to SIGPIPE or if the target directory is missing. It is recommended to append || true inside the command substitutions to handle these cases gracefully.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| src_dmg="$(find "$out" -type f -name '*.dmg' | head -n1)" | ||
| src_zip="$(find "$out" -type f -name '*.zip' | head -n1)" |
There was a problem hiding this comment.
Using find ... | head -n1 in combination with set -euo pipefail can lead to flaky failures or unexpected early exits:
SIGPIPE/pipefailissue: Iffindproduces multiple lines of output,head -n1will exit early after reading the first line. This closes the pipe, causingfindto receive aSIGPIPEsignal and exit with status 141. Underpipefail, this non-zero exit status propagates and triggersset -e, crashing the script.- Bypassing error handling: If the
$outdirectory does not exist,findwill fail. Instead of reaching the friendly error message andexit 1on lines 16-20, the script will crash immediately on line 14 or 15.
Appending || true to the command inside the command substitution ensures the assignment always succeeds, allowing the script to handle missing files or directories gracefully in the subsequent if block.
| src_dmg="$(find "$out" -type f -name '*.dmg' | head -n1)" | |
| src_zip="$(find "$out" -type f -name '*.zip' | head -n1)" | |
| src_dmg="$(find "$out" -type f -name '*.dmg' | head -n1 || true)" | |
| src_zip="$(find "$out" -type f -name '*.zip' | head -n1 || true)" |
Problem
The Release workflow's
collect-release-artifacts.shusedshopt -s globstar+**recursive globs. macOS GitHub runners (macos-14) ship bash 3.2, whereglobstardoesn't exist, so the step failed withshopt: globstar: invalid shell option nameand the release aborted after building the DMG but before publishing.Observed in the
v0.1.1-rc1run (Release workflow's first-ever execution).Fix
Replace the recursive globs with
find, which works on bash 3.2+. Verified locally on bash 3.2.57 (same as the runner): finds artifacts, canonicalizes names, writesSHASUMS256.txt, exits 0.Test plan
bash -nsyntax check on bash 3.2.57out/makeartifactsv0.1.1-rcNprerelease after merge to validate end-to-end