Skip to content

Commit dcb9592

Browse files
committed
fix: improve Dockerfile change detection in CI workflow
1 parent f73e04c commit dcb9592

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

.github/workflows/github-docker-registry-push.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,16 @@ jobs:
7878
- name: Check for Dockerfile and context changes
7979
# This step checks for changes in Dockerfile and context
8080
run: |
81+
HAS_DOCKER_CHANGES=false
8182
for file in ${{ env.files }}; do
82-
if [[ $file =~ (^|/)Dockerfile($|/)|(^|/)dockerfiles/ ]]; then
83-
echo "Dockerfile or dockerfiles directory has changed."
84-
echo "Changed file: $file"
83+
if [[ "$file" =~ (^|/)Dockerfile($|/)|(^|/)dockerfiles/ ]]; then
84+
echo "Dockerfile or dockerfiles directory has changed: $file"
85+
HAS_DOCKER_CHANGES=true
8586
break
8687
fi
8788
done
88-
89-
if (( $? == 0 )); then
89+
90+
if [[ "$HAS_DOCKER_CHANGES" == "false" ]]; then
9091
echo "No Dockerfile or context directory changes. Skipping Docker image build and push steps."
9192
echo "Changed files: ${{ env.files }}"
9293
fi

0 commit comments

Comments
 (0)