Skip to content

Update tree-sitter parsers JSON #681

Update tree-sitter parsers JSON

Update tree-sitter parsers JSON #681

---
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"