diff --git a/.gitea/workflows/pr-pipeline.yaml b/.gitea/workflows/pr-pipeline.yaml index 7525b10..9ffe552 100644 --- a/.gitea/workflows/pr-pipeline.yaml +++ b/.gitea/workflows/pr-pipeline.yaml @@ -43,17 +43,21 @@ jobs: echo "=== Prose Contract Frontmatter Validation ===" FAILED=0 for f in $(find . -name "*.prose.md" -not -path "./.git/*" -not -path "./runs/*"); do + # NOTE: use herestrings, not `echo "$FM" | grep ...`. Under the runner's + # `-e -o pipefail`, `grep -q` exits on first match and can SIGPIPE the + # producer, making the pipeline report non-zero and raising a false + # "Missing name/description" whose file set varies run to run. FM=$(sed -n '/^---$/,/^---$/p' "$f" | sed '1d;$d') [ -z "$FM" ] && { echo " ❌ $f: No YAML frontmatter"; FAILED=$((FAILED+1)); continue; } - KIND=$(echo "$FM" | grep '^kind:' | awk '{print $2}') + KIND=$(grep '^kind:' <<< "$FM" | awk '{print $2}') case "$KIND" in function|responsibility|gateway|pattern|test|template|architecture|enforcement) echo " ✅ $f: kind=$KIND" ;; *) echo " ❌ $f: Invalid kind='$KIND'"; FAILED=$((FAILED+1)) ;; esac - echo "$FM" | grep -q '^name:' || { echo " ❌ $f: Missing name"; FAILED=$((FAILED+1)); } - echo "$FM" | grep -q '^description:' || { echo " ❌ $f: Missing description"; FAILED=$((FAILED+1)); } + grep -q '^name:' <<< "$FM" || { echo " ❌ $f: Missing name"; FAILED=$((FAILED+1)); } + grep -q '^description:' <<< "$FM" || { echo " ❌ $f: Missing description"; FAILED=$((FAILED+1)); } done [ $FAILED -gt 0 ] && { echo "❌ FRONTMATTER FAILED ($FAILED error(s))"; exit 1; } echo "✅ Frontmatter validation passed"