forked from nickmackenzie/dont-get-zohod
-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (30 loc) · 1.11 KB
/
namingConvention.yaml
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
name: Verify Naming Convention
on:
push:
paths:
- "**/*" # Trigger the workflow on any file or folder change
jobs:
verifyNaming:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Verify names
run: |
# Get a list of all files and folders in the pages directory
pages_items=$(git ls-files pages/**/* && git ls-tree -d --name-only -r HEAD pages)
# Iterate through the files and folders and check their names
for item in $pages_items; do
# Check if the item is a file or a folder
if [[ -f $item || -d $item ]]; then
# Get the base name of the file or folder (without extension)
base_name=$(basename "$item")
# Check if the base name is in camel case
if [[ $base_name =~ ^[a-z]+([A-Z][a-z0-9]+)*$ ]]; then
echo "Item $item has a valid name."
else
echo "Item $item does not have a valid name (camel case required)."
exit 1
fi
fi
done