Files
prose-contracts/.gitea/workflows/pr-pipeline.yaml
T
root 57605c6f16 docs: add AGENTS.md + authorization enforcement gates
NEW: AGENTS.md — complete agent workflow documentation
- Step-by-step PR workflow for all agents
- Authorization matrix (who can change which contracts)
- Emergency bypass procedure
- Quick start commands

NEW: scripts/prose-auth-check.sh — authorization enforcement
- Blocks unauthorized agents from changing CRITICAL contracts
- infrastructure-control, proxmox-monitor: abiba only
- hermes-config-template: abiba, mumuni, tanko
- zulip-health: abiba, mumuni
- All scripts: abiba only
- Fails CI if unauthorized changes detected

UPDATED: .gitea/workflows/pr-pipeline.yaml
- Added Stage 0: auth check (runs first)
- Added gate job that confirms all 4 checks passed
- Expanded trigger paths to include scripts/*.sh

UPDATED: branch protection — now requires 4 contexts:
  pr-pipeline / auth, validate, lint, ai-review
2026-07-04 22:25:05 +00:00

88 lines
2.8 KiB
YAML

name: PR Pipeline — Authorize → Validate → Review → Merge
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- '**.prose.md'
- 'scripts/**.sh'
- '**.yaml'
- '**.yml'
jobs:
auth:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authorization check
run: bash scripts/prose-auth-check.sh
validate:
runs-on: ubuntu-latest
needs: auth
steps:
- uses: actions/checkout@v4
- name: YAML frontmatter validation
run: |
echo "=== Prose Contract Frontmatter Validation ==="
FAILED=0
for f in $(find . -name "*.prose.md" -not -path "./.git/*" -not -path "./runs/*"); do
FM=$(sed -n '/^---$/,/^---$/p' "$f" | sed '1d;$d')
[ -z "$FM" ] && { echo " ❌ $f: No YAML frontmatter"; FAILED=1; continue; }
KIND=$(echo "$FM" | grep '^kind:' | awk '{print $2}')
case "$KIND" in
function|responsibility|gateway|pattern|test|template|architecture) echo " ✅ $f: kind=$KIND" ;;
*) echo " ❌ $f: Invalid kind='$KIND'"; FAILED=1 ;;
esac
echo "$FM" | grep -q '^name:' || { echo " ❌ $f: Missing name"; FAILED=1; }
echo "$FM" | grep -q '^description:' || { echo " ❌ $f: Missing description"; FAILED=1; }
done
[ $FAILED -eq 1 ] && { echo "❌ FRONTMATTER FAILED"; exit 1; }
echo "✅ Frontmatter validation passed"
lint:
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v4
- name: Structure + regression + consistency lint
run: bash scripts/prose-lint.sh
ai-review:
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: AI-powered contract review
env:
LITELLM_URL: ${{ secrets.LITELLM_URL }}
LITELLM_KEY: ${{ secrets.LITELLM_KEY }}
run: bash scripts/prose-ai-review.sh
gate:
runs-on: ubuntu-latest
needs: [auth, validate, lint, ai-review]
if: success()
steps:
- name: Merge gate
run: |
echo "╔══════════════════════════════════════╗"
echo "║ ALL CHECKS PASSED — SAFE TO MERGE ║"
echo "╚══════════════════════════════════════╝"
echo ""
echo " ✅ auth — authorized agent"
echo " ✅ validate — frontmatter valid"
echo " ✅ lint — structure + no regressions"
echo " ✅ ai-review — no contradictions with ground truth"
echo ""
echo "Merge this PR to deploy to main."