Repository navigation
83 lines (71 loc) · 2.92 KB
/
Copy pathvalidate-adventures.yml
File metadata and controls
83 lines (71 loc) · 2.92 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Validate Adventures
on:
pull_request:
paths:
- 'src/data/adventures/**'
- 'src/data/solutions/**'
- 'src/content.config.ts'
- 'public/.well-known/agent-skills/**'
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 1
- uses: actions/setup-node@v7
with:
node-version-file: '.nvmrc'
cache: npm
- uses: actions/cache@v6
id: node-cache
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci
# astro sync loads the content collection and runs the Zod schema over every
# adventure.yaml. Invalid YAML (unknown field, bad enum, missing required)
# fails here — this replaces the old ajv `generate-adventures.mjs --validate-only`.
- name: Validate adventure YAML (Zod content schema)
run: npm run sync
- name: Validate adventure consistency
run: |
set -euo pipefail
ERRORS=0
for adventure_dir in src/data/adventures/*/; do
adventure_id=$(basename "$adventure_dir")
[[ -f "$adventure_dir/adventure.yaml" ]] || continue
echo "Checking adventure: $adventure_id"
# Live level IDs parsed via the yaml package (avoids fragile awk line-matching)
level_ids=$(YAML_PATH="$adventure_dir/adventure.yaml" node -e "const y=require('yaml'),f=require('fs');(y.parse(f.readFileSync(process.env.YAML_PATH,'utf8')).levels||[]).forEach(l=>console.log(l.level));")
for level_id in $level_ids; do
# A discussion JSON file must exist for each live level.
if [[ ! -f "$adventure_dir/$level_id-posts.json" ]]; then
echo " ❌ Missing discussion JSON: $adventure_dir$level_id-posts.json"
ERRORS=$((ERRORS + 1))
fi
done
echo " ✓ Done"
done
if [[ $ERRORS -gt 0 ]]; then
echo ""
echo "❌ Found $ERRORS consistency error(s)."
exit 1
fi
echo "✓ All adventures are consistent."
- name: Verify SKILL.md digest
run: |
actual=$(sha256sum public/.well-known/agent-skills/offon/SKILL.md | cut -d' ' -f1)
stored=$(node -e "const j=require('./public/.well-known/agent-skills/index.json'); console.log(j.skills[0].digest.replace('sha256:', ''))")
if [ "$actual" != "$stored" ]; then
echo "SKILL.md digest mismatch — update the digest in index.json after editing SKILL.md"
echo " index.json: sha256:$stored"
echo " computed: sha256:$actual"
exit 1
fi
echo "✓ SKILL.md digest OK: sha256:$actual"