-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathframework-structure-guardrails.yml
More file actions
62 lines (54 loc) · 1.93 KB
/
framework-structure-guardrails.yml
File metadata and controls
62 lines (54 loc) · 1.93 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: framework-structure-guardrails
on:
pull_request:
push:
branches:
- main
jobs:
validate-framework-structure:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate check.sql score aliasing
run: |
ERRORS=0
REQ_ROOT="skills/ai-ready-data/requirements"
for req_dir in "$REQ_ROOT"/*/; do
[ -d "$req_dir" ] || continue
[ -d "$req_dir/snowflake" ] || continue
check_sql="$req_dir/snowflake/check.sql"
if [ -f "$check_sql" ]; then
if ! grep -qi '\bas\s\+value\b' "$check_sql" 2>/dev/null; then
echo "ERROR: $check_sql must alias score as \`value\`"
ERRORS=$((ERRORS + 1))
fi
fi
done
[ "$ERRORS" -eq 0 ] || exit 1
- name: Validate manifest factors and scopes
run: |
MANIFEST="skills/ai-ready-data/requirements/requirements.yaml"
[ -f "$MANIFEST" ] || { echo "No manifest found"; exit 0; }
ERRORS=0
VALID_FACTORS="clean contextual consumable current correlated compliant"
for factor in $(grep '^\s\+factor:' "$MANIFEST" | sed 's/.*factor:[[:space:]]*//' | sort -u); do
matched=false
for vf in $VALID_FACTORS; do
[ "$factor" = "$vf" ] && matched=true
done
if ! $matched; then
echo "ERROR: Invalid factor in manifest: $factor"
ERRORS=$((ERRORS + 1))
fi
done
for scope in $(grep '^\s\+scope:' "$MANIFEST" | sed 's/.*scope:[[:space:]]*//' | sort -u); do
case "$scope" in
schema|table|column) ;;
*)
echo "ERROR: Invalid scope in manifest: $scope"
ERRORS=$((ERRORS + 1))
;;
esac
done
[ "$ERRORS" -eq 0 ] || exit 1