mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-13 17:00:09 -04:00
feat(CI): auto-update README.md
This commit is contained in:
parent
ac13baadb6
commit
ffe7d96dfd
3 changed files with 17 additions and 10 deletions
22
.github/workflows/update-readme.yml
vendored
22
.github/workflows/update-readme.yml
vendored
|
|
@ -1,11 +1,12 @@
|
||||||
name: Check README parser info
|
name: Check README parser info
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: push
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
luacheck:
|
update-readme:
|
||||||
name: Check README parser info
|
name: Check README parser info
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.ref != 'master'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
|
||||||
|
|
@ -18,8 +19,17 @@ jobs:
|
||||||
mkdir -p ~/.local/share/nvim/site/pack/nvim-treesitter/start
|
mkdir -p ~/.local/share/nvim/site/pack/nvim-treesitter/start
|
||||||
ln -s $(pwd) ~/.local/share/nvim/site/pack/nvim-treesitter/start
|
ln -s $(pwd) ~/.local/share/nvim/site/pack/nvim-treesitter/start
|
||||||
|
|
||||||
- name: Compile parsers
|
# inspired by nvim-lspconfigs
|
||||||
run: ./nvim.appimage --headless -c "TSInstallSync all" -c "q"
|
|
||||||
|
|
||||||
- name: Check README
|
- name: Check README
|
||||||
run: ./nvim.appimage --headless -c "luafile ./scripts/update-readme.lua" -c "q"
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
COMMIT_MSG: |
|
||||||
|
[docgen] Update README.md
|
||||||
|
skip-checks: true
|
||||||
|
run: |
|
||||||
|
git config user.email "actions@github"
|
||||||
|
git config user.name "Github Actions"
|
||||||
|
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
|
||||||
|
./nvim.appimage --headless -c "luafile ./scripts/update-readme.lua" -c "q" || git add README.md
|
||||||
|
# Only commit and push if we have changes
|
||||||
|
git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin HEAD:${GITHUB_REF})
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ We are looking for maintainers to write query files for their languages.
|
||||||
|
|
||||||
List of currently supported languages:
|
List of currently supported languages:
|
||||||
|
|
||||||
<!--Update this section by running `nvim --headless -c "luafile ./scripts/update-readme.lua"`-->
|
<!--This section of the README is automatically updated by a CI job-->
|
||||||
<!--parserinfo-->
|
<!--parserinfo-->
|
||||||
- [x] [bash](https://github.com/tree-sitter/tree-sitter-bash) (maintained by @TravonteD)
|
- [x] [bash](https://github.com/tree-sitter/tree-sitter-bash) (maintained by @TravonteD)
|
||||||
- [x] [c](https://github.com/tree-sitter/tree-sitter-c) (maintained by @vigoux)
|
- [x] [c](https://github.com/tree-sitter/tree-sitter-c) (maintained by @vigoux)
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,5 @@ if string.find(readme_text, generated_text, 1, 'plain') then
|
||||||
else
|
else
|
||||||
print("New README.md was written. Please commit that change! Old text was: ")
|
print("New README.md was written. Please commit that change! Old text was: ")
|
||||||
print(string.sub(readme_text, string.find(readme_text, "<!%-%-parserinfo%-%->.*<!%-%-parserinfo%-%->")))
|
print(string.sub(readme_text, string.find(readme_text, "<!%-%-parserinfo%-%->.*<!%-%-parserinfo%-%->")))
|
||||||
print("\n")
|
|
||||||
print('If you see this on CI, please run `nvim --headless -c "luafile ./scripts/update-readme.lua"` '
|
|
||||||
..'locally and commit the changes!')
|
|
||||||
vim.cmd('cq')
|
vim.cmd('cq')
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue