Skip to content

feat(lean): mirror the A2 reversibility↔CNO bridge (UNVERIFIED — env-… #311

feat(lean): mirror the A2 reversibility↔CNO bridge (UNVERIFIED — env-…

feat(lean): mirror the A2 reversibility↔CNO bridge (UNVERIFIED — env-… #311

# SPDX-License-Identifier: MPL-2.0
name: Language Policy Enforcement
on:
push:
branches: [main, master]
pull_request:
# Estate guardrail: scope push to default branches so a PR fires once (not
# push+PR), and cancel superseded runs. Safe — read-only PR-triggered check.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- 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"