Skip to content

Commit edff514

Browse files
authored
Merge pull request #3 from infosiftr/git-fetch
Adjust GitHub Actions to "git fetch" the current repository's history…
2 parents c74be66 + abb0e55 commit edff514

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

scripts/github-actions/generate.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ export BASHBREW_LIBRARY="$tmp/library"
2626

2727
eval "${GENERATE_STACKBREW_LIBRARY:-./generate-stackbrew-library.sh}" > "$BASHBREW_LIBRARY/$image"
2828

29+
# 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+
git -C "$bashbrewGit" fetch --quiet "$PWD" HEAD > /dev/null
33+
bashbrew from "$image" > /dev/null
34+
fi
35+
2936
tags="$(bashbrew list --build-order --uniq "$image")"
3037

3138
# see https://github.com/docker-library/python/commit/6b513483afccbfe23520b1f788978913e025120a for the ideal of what this would be (minimal YAML in all 30+ repos, shared shell script that outputs fully dynamic steps list), if GitHub Actions were to support a fully dynamic steps list
@@ -38,13 +45,14 @@ for tag in $tags; do
3845
meta="$(
3946
bashbrew cat --format '
4047
{{- $e := .TagEntry -}}
48+
{{- $arch := $e.HasArchitecture arch | ternary arch ($e.Architectures | first) -}}
4149
{{- "{" -}}
4250
"name": {{- json ($e.Tags | first) -}},
4351
"tags": {{- json ($.Tags namespace false $e) -}},
44-
"directory": {{- json $e.Directory -}},
45-
"file": {{- json $e.File -}},
52+
"directory": {{- json ($e.ArchDirectory $arch) -}},
53+
"file": {{- json ($e.ArchFile $arch) -}},
4654
"constraints": {{- json $e.Constraints -}},
47-
"froms": {{- json ($.DockerFroms $e) -}}
55+
"froms": {{- json ($.ArchDockerFroms $arch $e) -}}
4856
{{- "}" -}}
4957
' "$bashbrewImage" | jq -c '
5058
{

0 commit comments

Comments
 (0)