Skip to content

Commit 9657452

Browse files
committed
update code
1 parent 9f7df0c commit 9657452

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
uses: ./
1616
with:
1717
base_ref: 027b33661ae3211230e8cd03d19df49ba620b379
18-
head_ref: 182a672418c5bae4d6b7ca1244da5f28bf5ff6f0
18+
head_ref: ${{ github.sha }}
1919
kustomizations: |-
2020
testdata/prod
2121
testdata/stage

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)