ci: Check that non-scripts aren’t marked executable.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2022-12-05 16:12:00 -08:00
committed by Tim Abbott
parent 761ca16d6d
commit 872f4b41c1
16 changed files with 10 additions and 0 deletions

9
tools/ci/check-executables Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
files="$(git ls-tree -r @ | sed -n 's/^100755 blob \S\+\t//p' | xargs -r grep -Lz '^#!' --)" || [ $? = 123 ]
if [ "$files" ]; then
echo 'error: non-scripts should not be marked executable (fix with chmod -x):'
echo
printf '%s\n' "$files"
exit 1
fi