From 158f28dd36f0c01e257f8e7657e51fde4b62dcdb Mon Sep 17 00:00:00 2001 From: Jeremy Massel <1123407+jkmassel@users.noreply.github.com> Date: Tue, 26 May 2026 15:15:02 -0600 Subject: [PATCH] ci: replace bash 4 mapfile with portable while-read loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `mapfile` is a Bash 4+ builtin. The `Clean up pr-build/*` step runs on the `mac` queue, where macOS ships Bash 3.2 — so the script aborts at line 25 with `mapfile: command not found` (exit 127), failing every trunk build. Replace with a `while IFS= read -r ... done < <(...)` loop, which is equivalent under both Bash 3.2 and 4+. Build that surfaced this: https://buildkite.com/automattic/gutenbergkit/builds/2360 --- .buildkite/cleanup-pr-build-branches.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.buildkite/cleanup-pr-build-branches.sh b/.buildkite/cleanup-pr-build-branches.sh index 13db49b6b..69b4ddeec 100755 --- a/.buildkite/cleanup-pr-build-branches.sh +++ b/.buildkite/cleanup-pr-build-branches.sh @@ -22,7 +22,12 @@ echo '--- :robot_face: Use bot for Git operations' source use-bot-for-git echo "--- :mag: Listing pr-build/* branches on origin" -mapfile -t branches < <( +# `mapfile` is Bash 4+; macOS CI agents ship Bash 3.2, so use a portable +# `while read` loop instead. +branches=() +while IFS= read -r branch; do + branches+=("$branch") +done < <( git ls-remote --heads origin 'refs/heads/pr-build/*' \ | awk '{print $2}' \ | sed 's|^refs/heads/||'