-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmany--prevent-wrong-file-names.yaml
More file actions
43 lines (39 loc) · 1.4 KB
/
many--prevent-wrong-file-names.yaml
File metadata and controls
43 lines (39 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Prevent capital file extensions
# Prevents uppercase file extensions. This makes sure that files always end in
# a lowercase file extension, making it easier to write workflows expecting a
# certain file type.
on:
pull_request:
types: [opened, synchronize, reopened]
branches: [main, master, release, development]
paths: [ "**/*.*" ]
push:
branches: [main, master, release, development]
paths: [ "**/*.*" ]
jobs:
check-all-files:
name: Check all files
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.3.0
- name: Search for files violating naming convention
run: |
echo "Looking for files with capital extensions..."
# skip .git, and vendor directories
matches=$(find . \
-name .git -prune -o \
-path ./vendor -prune -o \
-path ./.github/CODEOWNERS -prune -o \
-path ./LICENSE -prune -o \
-type f -print | grep -E '(.*/.*[[:space:]].*|.*\.[A-Z]+$)' || true)
if [ -n "$matches" ]; then
echo "ERROR: Found files That do not respect naming convention:"
echo ""
echo "$matches"
echo ""
echo "Please rename the files to only use lower case extensions and no spaces."
exit 1
else
echo "All files respect naming convention."
fi