Update assign.ts #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Enforce kebab-case | |
on: [push, pull_request] | |
jobs: | |
check-filenames: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Check For Non Kebab-Cased File Names | |
run: | | |
non_compliant_files=() | |
ignoreList=( | |
"^\.\/\..*\/" # Ignore hidden flies | |
"^\.\/[^\/]*$" # Ignore files in root project directory | |
"^\.\/node_modules" | |
"^\.\/\.git" | |
"^\.\/dist" | |
"^\.\/build" | |
"^\.\/vendor" | |
"^\.\/\.next" | |
"\.sql$" | |
"\.md$" | |
"\.d.ts$" | |
"^\.\/\log-app" | |
) | |
while read -r file; do | |
basefile=$(basename "$file") | |
ignoreFile=false | |
for pattern in "${ignoreList[@]}"; do | |
if echo "$file" | grep -q -E "$pattern"; then | |
ignoreFile=true | |
break | |
fi | |
done | |
if $ignoreFile; then | |
continue | |
elif ! echo "$basefile" | grep -q -E "^([a-z0-9]+-)*[a-z0-9]+(\.[a-zA-Z0-9]+)?$|^([a-z0-9]+_)*[a-z0-9]+(\.[a-zA-Z0-9]+)?$"; then | |
non_compliant_files+=("$file") | |
echo "::warning file=$file::This file is not in kebab-case or snake_case" | |
fi | |
done < <(find . -type f) | |
if [ ${#non_compliant_files[@]} -ne 0 ]; then | |
echo "The following files are not in kebab-case or snake_case:" | |
for file in "${non_compliant_files[@]}"; do | |
echo " - $file" | |
done | |
exit 1 | |
fi |