Skip to content

Updated folder/files names to match convention #33

Updated folder/files names to match convention

Updated folder/files names to match convention #33

name: Verify Camel Case Naming Convention
on:
pull_request_target:
paths:
- "**/*" # Trigger the workflow on any file or folder change in a pull request
jobs:
verifyCamelCase:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Verify naming convention
run: |
# Get a list of all files and folders changed in the pull request
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
# Initialize an array to store incorrect items
incorrect_items=()
# Iterate through the changed files and check their names and paths for camel case
for item in $changed_files; do
# Check if the item is a file or a folder
if [[ -f $item || -d $item ]]; then
# Check if the file or folder name is in camel case
if ! [[ $(basename "$item") =~ ^[a-z]+([A-Z][a-z0-9]+)*$ ]]; then
incorrect_items+=("File/Folder Name: $item")
fi
else
# Check if the file path is in camel case
if [[ $item =~ ^[a-z]+([A-Z][a-z0-9]+)*/ ]]; then
incorrect_items+=("File Path: $item")
fi
fi
done
# Check if there are any incorrect items
if [[ ${#incorrect_items[@]} -gt 0 ]]; then
# Output the list of incorrect items
echo "The following items have invalid names or paths (camel case required):"
for item in "${incorrect_items[@]}"; do
echo "- $item"
done
exit 1
else
echo "All file names and paths in the pull request are in camel case."
fi