fix: add native git checkout + fix validator increment/exit bugs
- Replaced actions/checkout@v4 with native git clone (no Node.js needed) - Fixed FAILED counter: increment instead of resetting to 1 - Fixed exit condition: -gt 0 instead of -eq 1 (caught >1 violation) - Test-violations.prose.md still present — pipeline should now catch it
This commit is contained in:
@@ -19,55 +19,73 @@ jobs:
|
|||||||
auth:
|
auth:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Authorization check
|
- name: Checkout repository
|
||||||
run: |
|
run: |
|
||||||
[ -f scripts/prose-auth-check.sh ] || { echo "✅ No auth script — skipping"; exit 0; }
|
git clone --depth=50 "https://${{ gitea.server_url }}/${{ gitea.repository }}.git" .
|
||||||
bash scripts/prose-auth-check.sh
|
git fetch origin "${{ gitea.ref }}" --depth=50
|
||||||
|
git checkout "${{ gitea.sha }}"
|
||||||
|
|
||||||
|
- name: Authorization check
|
||||||
|
run: bash scripts/prose-auth-check.sh
|
||||||
|
|
||||||
validate:
|
validate:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: auth
|
needs: auth
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
run: |
|
||||||
|
git clone --depth=50 "https://${{ gitea.server_url }}/${{ gitea.repository }}.git" .
|
||||||
|
git fetch origin "${{ gitea.ref }}" --depth=50
|
||||||
|
git checkout "${{ gitea.sha }}"
|
||||||
|
|
||||||
- name: YAML frontmatter validation
|
- name: YAML frontmatter validation
|
||||||
run: |
|
run: |
|
||||||
echo "=== Prose Contract Frontmatter Validation ==="
|
echo "=== Prose Contract Frontmatter Validation ==="
|
||||||
FAILED=0
|
FAILED=0
|
||||||
for f in $(find . -name "*.prose.md" -not -path "./.git/*" -not -path "./runs/*"); do
|
for f in $(find . -name "*.prose.md" -not -path "./.git/*" -not -path "./runs/*"); do
|
||||||
FM=$(sed -n '/^---$/,/^---$/p' "$f" | sed '1d;$d')
|
FM=$(sed -n '/^---$/,/^---$/p' "$f" | sed '1d;$d')
|
||||||
[ -z "$FM" ] && { echo " ❌ $f: No YAML frontmatter"; FAILED=1; continue; }
|
[ -z "$FM" ] && { echo " ❌ $f: No YAML frontmatter"; FAILED=$((FAILED+1)); continue; }
|
||||||
|
|
||||||
KIND=$(echo "$FM" | grep '^kind:' | awk '{print $2}')
|
KIND=$(echo "$FM" | grep '^kind:' | awk '{print $2}')
|
||||||
case "$KIND" in
|
case "$KIND" in
|
||||||
function|responsibility|gateway|pattern|test|template|architecture|enforcement) echo " ✅ $f: kind=$KIND" ;;
|
function|responsibility|gateway|pattern|test|template|architecture|enforcement) echo " ✅ $f: kind=$KIND" ;;
|
||||||
*) echo " ❌ $f: Invalid kind='$KIND'"; FAILED=1 ;;
|
*) echo " ❌ $f: Invalid kind='$KIND'"; FAILED=$((FAILED+1)) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "$FM" | grep -q '^name:' || { echo " ❌ $f: Missing name"; FAILED=1; }
|
echo "$FM" | grep -q '^name:' || { echo " ❌ $f: Missing name"; FAILED=$((FAILED+1)); }
|
||||||
echo "$FM" | grep -q '^description:' || { echo " ❌ $f: Missing description"; FAILED=1; }
|
echo "$FM" | grep -q '^description:' || { echo " ❌ $f: Missing description"; FAILED=$((FAILED+1)); }
|
||||||
done
|
done
|
||||||
[ $FAILED -eq 1 ] && { echo "❌ FRONTMATTER FAILED"; exit 1; }
|
[ $FAILED -gt 0 ] && { echo "❌ FRONTMATTER FAILED ($FAILED error(s))"; exit 1; }
|
||||||
echo "✅ Frontmatter validation passed"
|
echo "✅ Frontmatter validation passed"
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: validate
|
needs: validate
|
||||||
steps:
|
steps:
|
||||||
- name: Structure + regression + consistency lint
|
- name: Checkout repository
|
||||||
run: |
|
run: |
|
||||||
[ -f scripts/prose-lint.sh ] || { echo "✅ No lint script — skipping"; exit 0; }
|
git clone --depth=50 "https://${{ gitea.server_url }}/${{ gitea.repository }}.git" .
|
||||||
bash scripts/prose-lint.sh
|
git fetch origin "${{ gitea.ref }}" --depth=50
|
||||||
|
git checkout "${{ gitea.sha }}"
|
||||||
|
|
||||||
|
- name: Structure + regression + consistency lint
|
||||||
|
run: bash scripts/prose-lint.sh
|
||||||
|
|
||||||
ai-review:
|
ai-review:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: validate
|
needs: validate
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
run: |
|
||||||
|
git clone --depth=50 "https://${{ gitea.server_url }}/${{ gitea.repository }}.git" .
|
||||||
|
git fetch origin "${{ gitea.ref }}" --depth=50
|
||||||
|
git checkout "${{ gitea.sha }}"
|
||||||
|
|
||||||
- name: AI-powered contract review
|
- name: AI-powered contract review
|
||||||
env:
|
env:
|
||||||
LITELLM_URL: ${{ secrets.LITELLM_URL }}
|
LITELLM_URL: ${{ secrets.LITELLM_URL }}
|
||||||
LITELLM_KEY: ${{ secrets.LITELLM_KEY }}
|
LITELLM_KEY: ${{ secrets.LITELLM_KEY }}
|
||||||
run: |
|
run: bash scripts/prose-ai-review.sh
|
||||||
[ -f scripts/prose-ai-review.sh ] || { echo "✅ No AI review script — skipping"; exit 0; }
|
|
||||||
bash scripts/prose-ai-review.sh
|
|
||||||
|
|
||||||
gate:
|
gate:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
Reference in New Issue
Block a user