Skip to content

Commit

Permalink
updated ci script
Browse files Browse the repository at this point in the history
  • Loading branch information
dmick92 committed Jan 18, 2024
1 parent b43cefd commit d0ae0f9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/namingConvention.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
name: Verify Naming Convention

on:
push:
pull_request_target:
paths:
- "**/*" # Trigger the workflow on any file or folder change
- "pages/**/*" # Trigger the workflow on any file or folder change within the pages directory in a pull request

jobs:
verifyNaming:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}

- 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)
# 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 }})
# Filter the list to include only items within the pages directory
pages_changed=$(echo "$changed_files" | grep '^pages/')
# Initialize an array to store incorrect items
incorrect_items=()
# Iterate through the files and folders and check their names
for item in $pages_items; do
for item in $pages_changed; do
# Check if the item is a file or a folder and does not start with an underscore
if [[ (-f $item || -d $item) && $item != pages/**/_* ]]; then
# Get the base name of the file or folder (without extension)
Expand Down

0 comments on commit d0ae0f9

Please sign in to comment.