Skip to content

Commit 0dd264c

Browse files
Create structure-guard.yml
1 parent 712c7a7 commit 0dd264c

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Enforce Repository Structure
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
structure-check:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Check modified paths
16+
run: |
17+
echo "Checking modified files..."
18+
19+
git fetch origin main
20+
CHANGED_FILES=$(git diff --name-only origin/main...HEAD)
21+
22+
echo "Changed files:"
23+
echo "$CHANGED_FILES"
24+
25+
INVALID_PATHS=$(echo "$CHANGED_FILES" | grep -Ev \
26+
'^(level-[0-9]+-|challenges/|resources/|roadmap/|\.github/|README.md|CONTRIBUTING.md|CODE_OF_CONDUCT.md|LICENSE)')
27+
28+
if [ -n "$INVALID_PATHS" ]; then
29+
echo "❌ Invalid paths detected:"
30+
echo "$INVALID_PATHS"
31+
echo ""
32+
echo "Contributions must follow the level-based structure."
33+
exit 1
34+
fi
35+
36+
echo "✅ Structure check passed."

0 commit comments

Comments
 (0)