Skip to content

Commit 7e160dc

Browse files
authored
Merge pull request #65 from infosiftr/gitCache
Udpate "github-actions/generate.sh" script to use "gitCache" and "bashbrew fetch"
2 parents efe1fec + abdd412 commit 7e160dc

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

scripts/github-actions/generate.sh

+4-8
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,10 @@ export BASHBREW_LIBRARY="$tmp/library"
2727
eval "${GENERATE_STACKBREW_LIBRARY:-./generate-stackbrew-library.sh}" > "$BASHBREW_LIBRARY/$image"
2828

2929
# 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
30-
if ! bashbrew from "$image" &> /dev/null; then
31-
bashbrewGit="${BASHBREW_CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/bashbrew}/git"
32-
if [ ! -d "$bashbrewGit" ]; then
33-
# if we're here, it's because "bashbrew from" failed so our cache directory might not have been created
34-
bashbrew from https://github.com/docker-library/official-images/raw/HEAD/library/hello-world:latest > /dev/null
35-
fi
36-
git -C "$bashbrewGit" fetch --quiet --update-shallow "$PWD" HEAD > /dev/null
37-
bashbrew from "$image" > /dev/null
30+
if ! bashbrew fetch "$image" &> /dev/null; then
31+
gitCache="$(bashbrew cat --format '{{ gitCache }}' "$image")"
32+
git -C "$gitCache" fetch --quiet --update-shallow "$PWD" HEAD > /dev/null
33+
bashbrew fetch "$image" > /dev/null
3834
fi
3935

4036
tags="$(bashbrew list --build-order --uniq "$image")"

0 commit comments

Comments
 (0)