dev: Fixup action-dev-check
Avoid checking directories that do not exist.
@@ -24,18 +24,21 @@ check_image() {
EX=0
# Check workflows for devcontainer images
+if [ -d .github/workflows ]; then
for f in .github/workflows/* ; do
# Find all container images that look like our dev image, dropping the
# `-suffix` from the tag.
- for i in $(yq '.jobs.* | (.container | select(.) | (.image // .)) | match("ghcr.io/linkerd/dev:v[0-9]+").string' < "$f") ; do
+ for i in $(yq '.jobs.* | .container | select(.) | (.image // .) | match("ghcr.io/linkerd/dev:v[0-9]+").string' < "$f") ; do
if ! check_image "$i" "$f" ; then
EX=$((EX+1))
break
fi
done
done
+fi
# Check actions for devcontainer images
+if [ -d .github/actions ]; then
while IFS= read -r f ; do
for i in $(awk 'toupper($1) ~ "FROM" { print $2 }' "$f" \
| sed -Ene 's,(ghcr\.io/linkerd/dev:v[0-9]+).*,\1,p')
@@ -46,5 +49,6 @@ while IFS= read -r f ; do
fi
done
done < <(find .github/actions -name Dockerfile\*)
+fi
exit $EX
