Skip to content

Commit 8146a7b

Browse files
authored
ci: add workflow to check grammar against Linguist compiler (#223)
The Hack grammar in this repo is also consumed by https://github.com/github-linguist/linguist to power syntax highlighting for github.com and GHE. VSCode seems to be rather tolerant of grammar errors but Linguist isn't, and we've occasionally gotten reports from Linguist upstream as a result, since any error in our grammar will block their releases. So run the Linguist compiler in CI when our grammar changes to catch issues.
1 parent 2076eaf commit 8146a7b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/linguist.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Verifies that the bundled TextMate grammar can be used by GitHub's Linguist highlighter.
2+
name: Linguist Grammar check
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
paths: ["syntaxes/hack.json", ".github/workflows/linguist.yml"]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Install PCRE development headers
20+
run: sudo apt update && sudo apt install -y libpcre3-dev
21+
- name: Checkout linguist repo
22+
uses: actions/checkout@v6
23+
with:
24+
repository: github-linguist/linguist
25+
path: linguist
26+
- uses: actions/setup-go@v6
27+
with:
28+
go-version-file: "linguist/tools/grammars/go.mod"
29+
- name: Checkout vscode-hack
30+
uses: actions/checkout@v6
31+
with:
32+
path: vscode-hack
33+
- name: Check Hack grammar
34+
run: cd linguist && go run ./tools/grammars/cmd/grammar-compiler add ../vscode-hack

0 commit comments

Comments
 (0)