Skip to content

Commit e48010b

Browse files
committed
update code
1 parent 9f7df0c commit e48010b

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

entrypoint.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,42 @@ set -eux
44

55
build_dir=$(mktemp -d)
66

7-
build() {
7+
build_base() {
88
ref="$1"
99
git checkout "$1" --quiet
1010

1111
for target in $INPUT_KUSTOMIZATIONS; do
12-
echo "Building $target" to "$build_dir/$ref/$target"
12+
echo "Building base $target" to "$build_dir/$ref/$target"
1313
mkdir -p "$build_dir/$ref/$target"
14+
if [ ! -d "$target" ]; then
15+
echo "Base $target does not exist. Treating it as an empty dir"
16+
mkdir -p "$target"
17+
else
18+
kustomize build "$target" -o "$build_dir/$ref/$target/"
19+
fi
20+
done
21+
}
22+
23+
build_head() {
24+
ref="$1"
25+
git checkout "$1" --quiet
26+
27+
for target in $INPUT_KUSTOMIZATIONS; do
28+
echo "Building head $target" to "$build_dir/$ref/$target"
29+
mkdir -p "$build_dir/$ref/$target"
30+
ls -al "$target"
1431
kustomize build "$target" -o "$build_dir/$ref/$target/"
1532
done
1633
}
1734

1835
git config --global --add safe.directory "$GITHUB_WORKSPACE"
1936

20-
build "$INPUT_BASE_REF"
21-
build "$INPUT_HEAD_REF"
22-
2337
base_ref_build_dir="$build_dir/$INPUT_BASE_REF"
2438
head_ref_build_dir="$build_dir/$INPUT_HEAD_REF"
2539

40+
build_base "$INPUT_BASE_REF"
41+
build_head "$INPUT_HEAD_REF"
42+
2643
set +e
2744
for target in $INPUT_KUSTOMIZATIONS; do
2845
diffoscope "$base_ref_build_dir/$target" "$head_ref_build_dir/$target" \

testdata/new/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
The point of this folder is to test that if the base commit does not contain this folder,
2-
the action is still successful
1+
The point of this folder is to test that if the base commit does not contain this folder, the action is still successful

0 commit comments

Comments
 (0)