|
| 1 | +name: validate |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + validate: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + |
| 14 | + - name: JSON files are valid |
| 15 | + run: | |
| 16 | + python3 - <<'PY' |
| 17 | + import json, sys |
| 18 | + ok = True |
| 19 | + for f in ['.claude-plugin/plugin.json', '.claude-plugin/marketplace.json', 'templates/settings.reference.json']: |
| 20 | + try: |
| 21 | + json.load(open(f)); print('OK ', f) |
| 22 | + except Exception as e: |
| 23 | + print('FAIL', f, e); ok = False |
| 24 | + sys.exit(0 if ok else 1) |
| 25 | + PY |
| 26 | +
|
| 27 | + - name: STANDARD weights sum to 100 (both levels) |
| 28 | + run: | |
| 29 | + python3 - <<'PY' |
| 30 | + import re, sys |
| 31 | + txt = open('STANDARD.md').read() |
| 32 | + cats = [int(w) for w in re.findall(r'^### .*weight (\d+)', txt, re.M)] |
| 33 | + crit = [int(w) for w in re.findall(r'^#### .*weight (\d+)', txt, re.M)] |
| 34 | + print('categories sum =', sum(cats), '| criteria sum =', sum(crit)) |
| 35 | + sys.exit(0 if sum(cats) == 100 and sum(crit) == 100 else 1) |
| 36 | + PY |
| 37 | +
|
| 38 | + - name: Internal markdown links resolve |
| 39 | + run: | |
| 40 | + python3 - <<'PY' |
| 41 | + import re, os, glob, sys |
| 42 | + errs = [] |
| 43 | + for md in glob.glob('**/*.md', recursive=True): |
| 44 | + d = os.path.dirname(md) |
| 45 | + for m in re.findall(r'\]\((\.[^)\s]+)\)', open(md).read()): |
| 46 | + p = m.split('#')[0] |
| 47 | + if p and not os.path.exists(os.path.normpath(os.path.join(d, p))): |
| 48 | + errs.append(f'{md} -> {m}') |
| 49 | + for e in errs: print('BROKEN', e) |
| 50 | + print('broken links:', len(errs)) |
| 51 | + sys.exit(0 if not errs else 1) |
| 52 | + PY |
0 commit comments