Skip to content

Commit a4c066c

Browse files
authored
Merge pull request #13 from shmokmt/pass-if-no-warnings
Pass the job if no warnings
2 parents ec63cc3 + 316fc97 commit a4c066c

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

script.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,25 @@ diagnostics: .warnings | map({
4747
})
4848
}'
4949

50-
docker_files=$(git ls-files --exclude='*Dockerfile*' --ignored --cached)
50+
docker_files=($(git ls-files --exclude='*Dockerfile*' --ignored --cached))
5151

5252
for docker_file in "${docker_files[@]}" ; do
53-
export DOCKER_FILE_PATH=${docker_file}
53+
54+
echo "::group:: docker build -f ${docker_file} --call=check,format=json"
5455
check_result=$(docker build -f "${docker_file}" --call=check,format=json . || true)
55-
echo "::group:: result of build --check"
56+
echo "::endgroup::"
57+
58+
echo "::group:: result of ${docker_file}"
5659
echo "$check_result"
5760
echo "::endgroups::"
61+
62+
warnings=$(echo "$check_result" | jq '.warnings')
63+
if [[ "$warnings" == "null" ]]; then
64+
echo "No warnings found in ${docker_file}"
65+
continue
66+
fi
67+
68+
export DOCKER_FILE_PATH=${docker_file}
5869
echo "$check_result" | jq "$docker_build_jq" \
5970
| reviewdog -f=rdjson -name="docker-build-check" \
6071
-reporter="${INPUT_REPORTER}" \

testdata/no_warnings/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM alpine
File renamed without changes.

0 commit comments

Comments
 (0)