docs: auto-generate OPTIONS.md from emmylua comments #1517
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: vimdoc | |
| on: | |
| push: | |
| branches: [main, vimdoc, fix-gen-opts] | |
| jobs: | |
| generate-docs: | |
| runs-on: [ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: rhysd/action-setup-vim@v1 | |
| with: | |
| neovim: true | |
| version: v0.10.4 | |
| - name: Setup treesitter | |
| run: | | |
| mkdir -p ~/.local/share/nvim/site/pack/vendor/start | |
| git clone --depth 1 https://github.com/ibhagwan/ts-vimdoc.nvim ~/.local/share/nvim/site/pack/vendor/start/ts-vimdoc.nvim | |
| git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter ~/.local/share/nvim/site/pack/vendor/start/nvim-treesitter | |
| - name: Build parser | |
| run: | | |
| export PACKPATH=$HOME/.local/share/nvim/site | |
| nvim --headless -u ~/.local/share/nvim/site/pack/vendor/start/ts-vimdoc.nvim/scripts/init.lua -c "TSUpdateSync markdown" -c "TSUpdateSync markdown_inline" -c "qa" | |
| - name: Generating vimdoc | |
| run: | | |
| export PATH="${PWD}/build/:${PATH}" | |
| export PACKPATH=$HOME/.local/share/nvim/site | |
| nvim --headless -u ~/.local/share/nvim/site/pack/vendor/start/ts-vimdoc.nvim/scripts/init.lua -c "lua require('ts-vimdoc').docgen({input_file='README.md', output_file='doc/fzf-lua.txt', project_name='fzf-lua', version='For Neovim >= 0.9.0'})" -c "qa" | |
| nvim --headless -u ~/.local/share/nvim/site/pack/vendor/start/ts-vimdoc.nvim/scripts/init.lua -c "lua require('ts-vimdoc').docgen({input_file='OPTIONS.md', output_file='doc/fzf-lua-opts.txt', project_name='fzf-lua-opts', table_of_contents_lvl_min = 2, table_of_contents_lvl_max = 3, version='For Neovim >= 0.9.0'})" -c "qa" | |
| - name: Install emmylua_doc_cli | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -e | |
| cd | |
| gh release download -R EmmyLuaLs/emmylua-analyzer-rust -p emmylua_doc_cli-linux-x64.tar.gz -D emmylua_doc_cli | |
| tar xzf emmylua_doc_cli/* -C emmylua_doc_cli | |
| echo "${PWD}/emmylua_doc_cli/" >> $GITHUB_PATH | |
| export PATH="${PWD}/emmylua_doc_cli/:${PATH}" | |
| emmylua_doc_cli --version | |
| - name: Generating OPTIONS.md | |
| run: | | |
| nvim --headless -l scripts/gen_options.lua | |
| - name: Commit changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| COMMIT_MSG: | | |
| [docgen] CI: autogenerate vimdoc | |
| 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 | |
| git add doc OPTIONS.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}) |