From 875dcb4f08e5b2d66c4e6fc1e7cdf37c67722a93 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 1 Dec 2021 12:03:30 -0800 Subject: [PATCH] Fix edge case around "bashbrew from" failing to create Git cache --- scripts/github-actions/generate.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/github-actions/generate.sh b/scripts/github-actions/generate.sh index 11ead65..18ae64d 100755 --- a/scripts/github-actions/generate.sh +++ b/scripts/github-actions/generate.sh @@ -29,6 +29,10 @@ eval "${GENERATE_STACKBREW_LIBRARY:-./generate-stackbrew-library.sh}" > "$BASHBR # if we don't appear to be able to fetch the listed commits, they might live in a PR branch, so we should force them into the Bashbrew cache directly to allow it to do what it needs if ! bashbrew from "$image" &> /dev/null; then bashbrewGit="${BASHBREW_CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/bashbrew}/git" + if [ ! -d "$bashbrewGit" ]; then + # if we're here, it's because "bashbrew from" failed so our cache directory might not have been created + bashbrew from https://github.com/docker-library/official-images/raw/HEAD/library/hello-world:latest > /dev/null + fi git -C "$bashbrewGit" fetch --quiet --update-shallow "$PWD" HEAD > /dev/null bashbrew from "$image" > /dev/null fi