@@ -32,22 +32,28 @@ jobs:
3232 - name : Get Test Services
3333 id : get-services
3434 run : |
35+ set -x
3536 base_commit=$(git rev-parse HEAD~1)
3637 merged_commit=$(git log -1 --format='%H')
3738 # git diff --name-only ${base_commit} ${merged_commit} | grep -E "cores|comps/__init__.py" | grep -Ev ".md"
38- # if [ $? -eq 0 ]; then
39+
3940 if git diff --name-only ${base_commit} ${merged_commit} | grep -E "cores|comps/__init__.py" | grep -Ev ".md"; then
4041 echo "ALL image build!!!"
4142 services=$(basename -a .github/workflows/docker/compose/*-compose.yaml | sed 's/-compose.yaml//' | jq -R '.' )
4243 else
4344 changed_src="$(git diff --name-only ${base_commit} ${merged_commit} | grep 'src/' | grep -vE '\.md')" || true
4445 changed_yamls="$(git diff --name-only ${base_commit} ${merged_commit} | grep '.github/workflows/docker/compose/')" || true
45- services=$(printf '%s\n' "${changed_src[@]}" | cut -d'/' -f2 | grep -vE '\.py' | sort -u | jq -R '.' ) || true
46- while IFS= read -r line; do
47- filename=$(basename "$line" -compose.yaml)
48- echo "$line $(printf '%s\n' "$filename" | jq -R '.' )"
49- services+=" $(printf '%s\n' "$filename" | jq -R '.' )" || true
50- done <<< "$changed_yamls"
46+ [[ -n "$changed_src" ]] && services=$(printf '%s\n' "${changed_src[@]}" | cut -d'/' -f2 | grep -vE '\.py' | sort -u | jq -R '.' ) || true
47+
48+ if [[ -n "$changed_yamls" ]]; then
49+ while IFS= read -r line; do
50+ filename=$(basename "$line" -compose.yaml)
51+ echo "$line $(printf '%s\n' "$filename" | jq -R '.' )"
52+ services+=" $(printf '%s\n' "$filename" | jq -R '.' )" || true
53+ done <<< "$changed_yamls"
54+ else
55+ echo "No changes in YAML files."
56+ fi
5157 fi
5258
5359 echo "services=$(echo "$services" | jq -sc 'unique | sort')"
5662
5763 image-build :
5864 needs : get-build-matrix
65+ if : ${{ fromJSON(needs.get-build-matrix.outputs.services).length != 0 }}
5966 strategy :
6067 matrix :
6168 service : ${{ fromJSON(needs.get-build-matrix.outputs.services) }}
6572 steps :
6673 - name : Clean up Working Directory
6774 run : |
75+ echo "matrix.service=${{ matrix.service }}"
6876 sudo rm -rf ${{github.workspace}}/*
6977
7078 - name : Checkout out Repo
0 commit comments