2022-11-01 15:55:59 +01:00
|
|
|
#!/usr/bin/env bash
|
2022-11-01 16:02:23 +01:00
|
|
|
# Script to verify if a file contain any entries starting with a slash and show a warning into the github action result UI.
|
|
|
|
# Received as input a list of file paths to check separated by a space.
|
|
|
|
# More precisely the result of the "tj-actions/changed-files" github action.
|
|
|
|
## References:
|
|
|
|
# See https://github.com/tj-actions/changed-files
|
2022-11-01 15:55:59 +01:00
|
|
|
modified_files="$1"
|
2022-11-01 16:02:23 +01:00
|
|
|
for modified_file in $modified_files
|
2022-11-01 15:55:59 +01:00
|
|
|
do
|
|
|
|
echo "[+] Check $modified_file ..."
|
|
|
|
matches=$(grep -cE '^/[a-zA-Z0-9\._]+' $modified_file)
|
|
|
|
if [ $matches -ne 0 ]
|
|
|
|
then
|
|
|
|
echo "::warning file=$modified_file,line=1,col=1,endColumn=1::$matches entries start with a slash."
|
|
|
|
fi
|
|
|
|
done
|