Skip to content

Commit b27d44d

Browse files
committed
Guard empty CodeQL hit files
1 parent b9bff60 commit b27d44d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

.github/workflows/codeql-guard.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ jobs:
9595
echo "::notice::Skipping stale or non-use search hit ${repo}:${path}"
9696
fi
9797
done <<< "${response}"
98-
printf '%s\n' "${hits[@]}" > /tmp/file-hits.tsv
98+
: > /tmp/file-hits.tsv
99+
(( ${#hits[@]} )) && printf '%s\n' "${hits[@]}" > /tmp/file-hits.tsv
99100
if [ "${#hits[@]}" -eq 0 ]; then
100101
echo "ok: no codeql-action workflow files found in any evalops repo"
101102
fi
@@ -130,7 +131,8 @@ jobs:
130131
dyn_hits+=("${repo}"$'\t'"${wid}")
131132
done <<< "${matches}"
132133
done <<< "${repos}"
133-
printf '%s\n' "${dyn_hits[@]}" > /tmp/dynamic-hits.tsv
134+
: > /tmp/dynamic-hits.tsv
135+
(( ${#dyn_hits[@]} )) && printf '%s\n' "${dyn_hits[@]}" > /tmp/dynamic-hits.tsv
134136
if [ "${#dyn_hits[@]}" -eq 0 ]; then
135137
echo "ok: no active dynamic CodeQL default-setup workflows in any evalops repo"
136138
else

0 commit comments

Comments
 (0)