Skip to content

Commit

Permalink
Create check-path-length.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasc-ubc committed Oct 28, 2024
1 parent 70e0279 commit 97f2fd0
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/check-path-length.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# .github/workflows/check-path-length.yml
name: Check Path Length

on:
push:
pull_request:

jobs:
check-path-length:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Check file path lengths
run: |
# Set the maximum allowed length
MAX_LENGTH=200
# Find all files in the repository and check their path lengths
too_long_paths=0
for file in $(find . -type f); do
length=${#file}
if (( length > MAX_LENGTH )); then
echo "Path too long: $file ($length characters)"
too_long_paths=$((too_long_paths + 1))
fi
done
if (( too_long_paths > 0 )); then
echo "Error: Found $too_long_paths file paths longer than $MAX_LENGTH characters."
exit 1
else
echo "All file paths are within the $MAX_LENGTH character limit."
fi

0 comments on commit 97f2fd0

Please sign in to comment.