-
-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (40 loc) · 1.66 KB
/
language-policy.yml
File metadata and controls
44 lines (40 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Language Policy Enforcement
on: [push, pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.1
- name: Enforce language policies
run: |
# Block new Python files (except SaltStack)
NEW_PY=$(git diff --name-only --diff-filter=A HEAD~1 2>/dev/null | grep -E '\.py$' | grep -v 'salt' || true)
if [ -n "$NEW_PY" ]; then
echo "❌ New Python files detected. Use Rust or ReScript instead."
echo "$NEW_PY"
exit 1
fi
# Block new Ruby files
NEW_RB=$(git diff --name-only --diff-filter=A HEAD~1 2>/dev/null | grep -E '\.rb$' || true)
if [ -n "$NEW_RB" ]; then
echo "❌ New Ruby files detected. Use Rust, Ada/SPARK, or Crystal instead."
echo "$NEW_RB"
exit 1
fi
# Block new Perl files
NEW_PL=$(git diff --name-only --diff-filter=A HEAD~1 2>/dev/null | grep -E '\.(pl|pm)$' || true)
if [ -n "$NEW_PL" ]; then
echo "❌ New Perl files detected. Use Rust instead."
echo "$NEW_PL"
exit 1
fi
# Block new Java/Kotlin (except in LSP projects)
if [[ ! "$GITHUB_REPOSITORY" =~ "language-server" ]]; then
NEW_JAVA=$(git diff --name-only --diff-filter=A HEAD~1 2>/dev/null | grep -E '\.(java|kt)$' || true)
if [ -n "$NEW_JAVA" ]; then
echo "❌ New Java/Kotlin files detected. Use Rust instead."
echo "$NEW_JAVA"
exit 1
fi
fi
echo "✅ Language policy check passed"