-
Notifications
You must be signed in to change notification settings - Fork 6
66 lines (63 loc) · 2.09 KB
/
update-ts-parsers-json.yml
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
---
name: Update tree-sitter parsers JSON
# Prevent concurrent auto-commits
concurrency:
group: update-tree-sitter-parsers-json
cancel-in-progress: true
on:
push:
branches:
- 'main'
paths:
- 'scripts/echo-ts-json.lua'
- 'scripts/parser-update-counts.jq'
- 'scripts/parser-update-counts.sh'
- 'scripts/queries-update-counts.sh'
- .github/workflows/update-ts-parsers-json.yml
schedule:
# Runs every 12 hours
- cron: "0 */12 * * *"
workflow_dispatch:
jobs:
update-tree-sitter-parsers-json:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/checkout@v4
with:
repository: nvim-treesitter/nvim-treesitter
path: nvim-treesitter
ref: main
fetch-depth: 0
- uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: nightly
- name: Update tree-sitter parsers JSON and parser update counts
run: |
cp tree-sitter-parsers.json prev.json
./scripts/echo-ts-json.lua \
| jq -S '{parsers: [to_entries[] | {lang: .key} + (.value | del(.maintainers))] | sort_by(.lang)}' \
> tree-sitter-parsers.json
./scripts/parser-update-counts.sh
pushd nvim-treesitter
# XXX: Because the main branch is currently rebased a lot,
# we use master as the reference for query updates
git checkout master
popd
./scripts/queries-update-counts.sh
- name: Update nvim-treesitter.lock
run: |
if git diff --quiet tree-sitter-parsers.json; then
echo "No parsers updated"
else
echo "Parsers updated"
cp nvim-treesitter/.git/refs/heads/main resources/nvim-treesitter.lock
fi
- name: commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: update tree-sitter-parsers.json"
file_pattern: "tree-sitter-parsers.json resources/nvim-treesitter.lock resources/ts-update-counts.json"