/ .github / workflows / language-policy.yml
language-policy.yml
 1  # SPDX-License-Identifier: AGPL-3.0-or-later
 2  name: Language Policy Enforcement
 3  
 4  on:
 5    push:
 6      branches: [main]
 7    pull_request:
 8      branches: [main]
 9  
10  permissions: read-all
11  
12  jobs:
13    check-banned-languages:
14      runs-on: ubuntu-latest
15      steps:
16        - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
17  
18        - name: Check for TypeScript files
19          run: |
20            ts_files=$(find . -name "*.ts" -not -name "*.d.ts" -not -path "./.git/*" -not -path "./node_modules/*" 2>/dev/null || true)
21            if [ -n "$ts_files" ]; then
22              echo "::error::TypeScript files detected (use ReScript instead):"
23              echo "$ts_files"
24              exit 1
25            fi
26            echo "No TypeScript files found"
27  
28        - name: Check for Python files
29          run: |
30            py_files=$(find . -name "*.py" -not -path "./.git/*" 2>/dev/null | grep -v -E "(salt|pillar|grain|state|sls)" || true)
31            if [ -n "$py_files" ]; then
32              echo "::error::Python files detected (only allowed for SaltStack):"
33              echo "$py_files"
34              exit 1
35            fi
36            echo "No banned Python files found"
37  
38        - name: Check for Go files
39          run: |
40            go_files=$(find . -name "*.go" -not -path "./.git/*" 2>/dev/null || true)
41            if [ -n "$go_files" ]; then
42              echo "::error::Go files detected (use Rust instead):"
43              echo "$go_files"
44              exit 1
45            fi
46            echo "No Go files found"
47  
48        - name: Check for package.json
49          run: |
50            pkg_files=$(find . -name "package.json" -not -path "./.git/*" -not -path "./node_modules/*" 2>/dev/null || true)
51            if [ -n "$pkg_files" ]; then
52              echo "::error::package.json detected (use deno.json instead):"
53              echo "$pkg_files"
54              exit 1
55            fi
56            echo "No package.json found"
57  
58        - name: Policy check passed
59          run: echo "All language policy checks passed"