-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (84 loc) · 2.94 KB
/
Copy pathci.yml
File metadata and controls
99 lines (84 loc) · 2.94 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
formula-tests:
name: Formula Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: python -m unittest tests/test_formulas.py -v
frontmatter-validation:
name: Frontmatter Validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate SKILL.md frontmatter
run: |
python3 -c "
import re, sys
text = open('SKILL.md').read()
m = re.match(r'^---\n(.*?)\n---', text, re.DOTALL)
if not m:
print('ERROR: No YAML frontmatter found in SKILL.md')
sys.exit(1)
# Simple two-level YAML parser (no dependencies)
data = {}
current_section = None
for line in m.group(1).strip().split('\n'):
if line.startswith(' '):
k, v = line.strip().split(':', 1)
data.setdefault(current_section, {})[k.strip()] = v.strip().strip('\"')
elif ':' in line:
k, v = line.split(':', 1)
v = v.strip().strip('\"')
if v:
data[k.strip()] = v
else:
current_section = k.strip()
required = {
'name': data.get('name'),
'description': data.get('description'),
'license': data.get('license'),
'metadata.author': (data.get('metadata') or {}).get('author'),
'metadata.version': (data.get('metadata') or {}).get('version'),
}
missing = [k for k, v in required.items() if not v]
if missing:
print(f'ERROR: Missing required frontmatter fields: {missing}')
sys.exit(1)
for k, v in required.items():
print(f' {k}: {v}')
print('Frontmatter OK')
"
reference-integrity:
name: Reference Integrity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check referenced files exist
run: |
python3 -c "
import re, os, sys
text = open('SKILL.md').read()
paths = re.findall(r'\x60((?:references|evals)/[a-zA-Z0-9._/-]+\.[a-z]+)\x60', text)
paths = sorted(set(paths))
if not paths:
print('WARNING: No file references found in SKILL.md')
sys.exit(0)
missing = [p for p in paths if not os.path.isfile(p)]
print(f'Checked {len(paths)} referenced files:')
for p in paths:
status = 'OK' if p not in missing else 'MISSING'
print(f' [{status}] {p}')
if missing:
print(f'ERROR: {len(missing)} missing file(s)')
sys.exit(1)
print('All referenced files exist.')
"