|
| 1 | +name: Validate Repo Structure |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + branches: [main] |
| 5 | + |
| 6 | +jobs: |
| 7 | + check-structure: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v4 |
| 11 | + |
| 12 | + - name: Check required root files |
| 13 | + run: | |
| 14 | + missing=0 |
| 15 | + for f in README.md CONTRIBUTING.md LICENSE CHANGELOG.md .gitignore; do |
| 16 | + if [ ! -f "$f" ]; then |
| 17 | + echo "::error::Missing required file: $f" |
| 18 | + missing=$((missing + 1)) |
| 19 | + fi |
| 20 | + done |
| 21 | + if [ $missing -gt 0 ]; then |
| 22 | + echo "::error::$missing required root file(s) missing" |
| 23 | + exit 1 |
| 24 | + fi |
| 25 | + echo "All required root files present" |
| 26 | +
|
| 27 | + - name: Check required directories |
| 28 | + run: | |
| 29 | + missing=0 |
| 30 | + for d in docs .github; do |
| 31 | + if [ ! -d "$d" ]; then |
| 32 | + echo "::error::Missing required directory: $d/" |
| 33 | + missing=$((missing + 1)) |
| 34 | + fi |
| 35 | + done |
| 36 | + if [ $missing -gt 0 ]; then |
| 37 | + echo "::error::$missing required directory(s) missing" |
| 38 | + exit 1 |
| 39 | + fi |
| 40 | + echo "All required directories present" |
| 41 | +
|
| 42 | + - name: Check PR template |
| 43 | + run: | |
| 44 | + if [ ! -f ".github/PULL_REQUEST_TEMPLATE.md" ]; then |
| 45 | + echo "::error::Missing .github/PULL_REQUEST_TEMPLATE.md" |
| 46 | + exit 1 |
| 47 | + fi |
| 48 | + echo "PR template found" |
| 49 | +
|
| 50 | + - name: Check config structure (if config dir exists) |
| 51 | + run: | |
| 52 | + if [ -d "config" ]; then |
| 53 | + missing=0 |
| 54 | + if [ ! -f "config/variables.example.yml" ]; then |
| 55 | + echo "::error::Missing config/variables.example.yml" |
| 56 | + missing=$((missing + 1)) |
| 57 | + fi |
| 58 | + if [ ! -f "config/schema/variables.schema.json" ]; then |
| 59 | + echo "::error::Missing config/schema/variables.schema.json" |
| 60 | + missing=$((missing + 1)) |
| 61 | + fi |
| 62 | + if [ $missing -gt 0 ]; then |
| 63 | + exit 1 |
| 64 | + fi |
| 65 | + echo "Config structure valid" |
| 66 | + else |
| 67 | + echo "No config/ directory — skipping config checks" |
| 68 | + fi |
| 69 | +
|
| 70 | + - name: Check variable reference doc (if config dir exists) |
| 71 | + run: | |
| 72 | + if [ -d "config" ]; then |
| 73 | + if [ ! -f "docs/reference/variables.md" ]; then |
| 74 | + echo "::error::Missing docs/reference/variables.md (required when config/ exists)" |
| 75 | + exit 1 |
| 76 | + fi |
| 77 | + echo "Variable reference doc found" |
| 78 | + else |
| 79 | + echo "No config/ directory — skipping variable reference check" |
| 80 | + fi |
0 commit comments