Add Git Level 1 basics + Git workflow project #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Enforce Repository Structure | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| structure-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Check modified paths | |
| run: | | |
| echo "Checking modified files..." | |
| git fetch origin main | |
| CHANGED_FILES=$(git diff --name-only origin/main...HEAD) | |
| echo "Changed files:" | |
| echo "$CHANGED_FILES" | |
| INVALID_PATHS=$(echo "$CHANGED_FILES" | grep -Ev \ | |
| '^(level-[0-9]+-|challenges/|resources/|roadmap/|\.github/|README.md|CONTRIBUTING.md|CODE_OF_CONDUCT.md|LICENSE)') | |
| if [ -n "$INVALID_PATHS" ]; then | |
| echo "❌ Invalid paths detected:" | |
| echo "$INVALID_PATHS" | |
| echo "" | |
| echo "Contributions must follow the level-based structure." | |
| exit 1 | |
| fi | |
| echo "✅ Structure check passed." |