/ .github / workflows / language-policy.yml
language-policy.yml
 1  # SPDX-License-Identifier: AGPL-3.0-or-later
 2  # SPDX-FileCopyrightText: 2025 Jonathan D.A. Jewell
 3  name: Language Policy Enforcement
 4  
 5  on:
 6    push:
 7      branches: [main]
 8    pull_request:
 9      branches: [main]
10  
11  permissions: read-all
12  
13  jobs:
14    enforce-language-policy:
15      runs-on: ubuntu-latest
16      steps:
17        - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
18  
19        - name: Check for banned TypeScript files
20          run: |
21            if find . -name "*.ts" -type f | grep -v node_modules | grep -q .; then
22              echo "ERROR: TypeScript files found. Use ReScript instead."
23              find . -name "*.ts" -type f | grep -v node_modules
24              exit 1
25            fi
26            echo "✓ No TypeScript files found"
27  
28        - name: Check for banned Go files
29          run: |
30            if find . -name "*.go" -type f | grep -q .; then
31              echo "ERROR: Go files found. Use Rust instead."
32              find . -name "*.go" -type f
33              exit 1
34            fi
35            echo "✓ No Go files found"
36  
37        - name: Check for banned Python files (except SaltStack)
38          run: |
39            # Allow Python only in salt/ directories
40            if find . -name "*.py" -type f | grep -v salt | grep -v node_modules | grep -q .; then
41              echo "ERROR: Python files found outside salt/. Python only allowed for SaltStack."
42              find . -name "*.py" -type f | grep -v salt | grep -v node_modules
43              exit 1
44            fi
45            echo "✓ No unauthorized Python files found"
46  
47        - name: Check for package.json runtime dependencies
48          run: |
49            if [ -f package.json ]; then
50              if jq -e '.dependencies // empty | keys | length > 0' package.json > /dev/null 2>&1; then
51                echo "WARNING: package.json has runtime dependencies. Prefer deno.json imports."
52              fi
53            fi
54            echo "✓ package.json check complete"
55  
56        - name: Verify ReScript configuration exists
57          run: |
58            if [ ! -f rescript.json ]; then
59              echo "ERROR: rescript.json not found. ReScript is required."
60              exit 1
61            fi
62            echo "✓ rescript.json found"