File tree Expand file tree Collapse file tree 4 files changed +29
-7
lines changed Expand file tree Collapse file tree 4 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,11 @@ jobs:
15
15
uses : ./
16
16
with :
17
17
base_ref : 027b33661ae3211230e8cd03d19df49ba620b379
18
- head_ref : 182a672418c5bae4d6b7ca1244da5f28bf5ff6f0
18
+ head_ref : ${{ github.sha }}
19
19
kustomizations : |-
20
20
testdata/prod
21
21
testdata/stage
22
+ testdata/new
22
23
- uses : mshick/add-pr-comment@v2
23
24
with :
24
25
message : ${{ steps.test-action.outputs.diff }}
Original file line number Diff line number Diff line change @@ -4,21 +4,37 @@ set -eux
4
4
5
5
build_dir=$( mktemp -d)
6
6
7
- build () {
8
- ref=" $1 "
9
- git checkout " $1 " --quiet
7
+ build_base () {
8
+ ref=" $INPUT_BASE_REF "
9
+ git checkout " $ref " --quiet
10
10
11
11
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 "
13
+ 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=" $INPUT_HEAD_REF "
25
+ git checkout " $ref " --quiet
26
+
27
+ for target in $INPUT_KUSTOMIZATIONS ; do
28
+ echo " Building head $target " to " $build_dir /$ref /$target "
13
29
mkdir -p " $build_dir /$ref /$target "
14
30
kustomize build " $target " -o " $build_dir /$ref /$target /"
15
31
done
16
32
}
17
33
18
34
git config --global --add safe.directory " $GITHUB_WORKSPACE "
19
35
20
- build " $INPUT_BASE_REF "
21
- build " $INPUT_HEAD_REF "
36
+ build_base
37
+ build_head
22
38
23
39
base_ref_build_dir=" $build_dir /$INPUT_BASE_REF "
24
40
head_ref_build_dir=" $build_dir /$INPUT_HEAD_REF "
Original file line number Diff line number Diff line change
1
+ The point of this folder is to test that if the base commit does not contain this folder, the action is still successful
Original file line number Diff line number Diff line change
1
+ apiVersion : kustomize.config.k8s.io/v1beta1
2
+ kind : Kustomization
3
+ resources :
4
+ - ../base
You can’t perform that action at this time.
0 commit comments