Add filename convention check #1
Workflow file for this run
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: Filename Check | |
on: [push, pull_request] | |
jobs: | |
check-filenames: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Check filenames for Windows compatibility # currently restricted to doc folder | |
run: | | |
with_capitals=$(find ./doc -type f \( -iname "*.md" -o -iname "*.png" \) | grep -E '/[A-Z]') | |
with_invalid_chars=$(find . -type f | grep -E '[<>:"/\\|?*]|[[:cntrl:]]') | |
if [ ! -z "$with_capitals" ] || [ ! -z "$with_invalid_chars" ]; then | |
echo "The following files do not follow the naming convention:" | |
[ ! -z "$with_capitals" ] && echo "Files with capitals:" && echo "$with_capitals" | |
[ ! -z "$with_invalid_chars" ] && echo "Files with Windows-restricted characters:" && echo "$with_invalid_chars" | |
exit 1 | |
fi |