Skip to content

Commit 4e27efe

Browse files
committed
Skeleton structure
0 parents  commit 4e27efe

File tree

12 files changed

+1009
-0
lines changed

12 files changed

+1009
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Validate Gemara Front Matter
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'risks/**/*.md'
8+
- 'practices/**/*.md'
9+
- 'capabilities/**/*.md'
10+
- 'cue/**/*.cue'
11+
pull_request:
12+
branches: [main]
13+
paths:
14+
- 'risks/**/*.md'
15+
- 'practices/**/*.md'
16+
- 'capabilities/**/*.md'
17+
- 'cue/**/*.cue'
18+
19+
jobs:
20+
validate:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Install CUE
27+
uses: cue-lang/setup-cue@v1.0.1
28+
with:
29+
version: 'latest'
30+
31+
- name: Install yq
32+
run: |
33+
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
34+
sudo chmod +x /usr/local/bin/yq
35+
36+
- name: Validate risk files
37+
run: |
38+
echo "Validating risk files against #Threat schema..."
39+
for file in risks/*.md; do
40+
if [ -f "$file" ]; then
41+
echo "Checking $file"
42+
# Extract gemara YAML from front matter
43+
gemara_yaml=$(sed -n '/^---$/,/^---$/p' "$file" | yq '.gemara' -o json 2>/dev/null)
44+
if [ "$gemara_yaml" != "null" ] && [ -n "$gemara_yaml" ]; then
45+
echo "$gemara_yaml" > /tmp/threat.json
46+
cue vet /tmp/threat.json cue/gemara/layer-2.cue -d '#Threat'
47+
echo "✓ $file validated"
48+
else
49+
echo "⚠ $file has no gemara front matter, skipping"
50+
fi
51+
fi
52+
done
53+
54+
- name: Validate practice files
55+
run: |
56+
echo "Validating practice files against #Control schema..."
57+
for file in practices/*.md; do
58+
if [ -f "$file" ]; then
59+
echo "Checking $file"
60+
gemara_yaml=$(sed -n '/^---$/,/^---$/p' "$file" | yq '.gemara' -o json 2>/dev/null)
61+
if [ "$gemara_yaml" != "null" ] && [ -n "$gemara_yaml" ]; then
62+
echo "$gemara_yaml" > /tmp/control.json
63+
cue vet /tmp/control.json cue/gemara/layer-2.cue -d '#Control'
64+
echo "✓ $file validated"
65+
else
66+
echo "⚠ $file has no gemara front matter, skipping"
67+
fi
68+
fi
69+
done
70+
71+
- name: Validate capability files
72+
run: |
73+
echo "Validating capability files against #Capability schema..."
74+
for file in capabilities/*.md; do
75+
if [ -f "$file" ]; then
76+
echo "Checking $file"
77+
gemara_yaml=$(sed -n '/^---$/,/^---$/p' "$file" | yq '.gemara' -o json 2>/dev/null)
78+
if [ "$gemara_yaml" != "null" ] && [ -n "$gemara_yaml" ]; then
79+
echo "$gemara_yaml" > /tmp/capability.json
80+
cue vet /tmp/capability.json cue/gemara/layer-2.cue -d '#Capability'
81+
echo "✓ $file validated"
82+
else
83+
echo "⚠ $file has no gemara front matter, skipping"
84+
fi
85+
fi
86+
done
87+
88+
- name: Validation complete
89+
run: echo "All Gemara front matter validated successfully!"

0 commit comments

Comments
 (0)