-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (48 loc) · 1.99 KB
/
validate.yml
File metadata and controls
56 lines (48 loc) · 1.99 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
name: Validate Extensions
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Check upstream-pinned highlight queries
run: bun run scripts/sync-upstream-queries.ts --check
- name: Validate extension manifests
run: bun run scripts/validate.ts
- name: Check manifests.json is up to date
run: |
bun run scripts/generate-manifests.ts
git diff --exit-code manifests.json || (echo "manifests.json is out of date. Run: bun run scripts/generate-manifests.ts" && exit 1)
- name: Check registry.json and index.json are up to date
run: bun run scripts/build-extensions-index.ts --check
- name: Validate grammar-sources.json
run: |
node -e "
const sources = require('./grammar-sources.json');
const fs = require('fs');
const dirs = fs.readdirSync('extensions', { withFileTypes: true })
.filter(d => d.isDirectory()).map(d => d.name);
let errors = 0;
for (const dir of dirs) {
const hasHighlights = fs.existsSync('extensions/' + dir + '/highlights.scm');
const hasSource = !!sources[dir];
if (hasHighlights && !hasSource) {
console.warn('Warning: ' + dir + ' has highlights.scm but no entry in grammar-sources.json');
}
}
for (const [lang, src] of Object.entries(sources)) {
if (!fs.existsSync('extensions/' + lang)) {
console.error('Error: grammar-sources.json references ' + lang + ' but extensions/' + lang + '/ does not exist');
errors++;
}
}
if (errors > 0) process.exit(1);
console.log('grammar-sources.json: OK (' + Object.keys(sources).length + ' grammars)');
"