ci: add formatting step for generated documentation #10
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: Generate docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - ".github/workflows/generate-docs.yml" | |
| - "types/**" | |
| workflow_dispatch: | |
| jobs: | |
| generate-docs: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Checkout docs generator | |
| run: git clone --depth 1 https://github.com/BlueLua/bluelua.github.io.git "${RUNNER_TEMP}/docgen" | |
| - name: Setup Lua | |
| uses: leafo/gh-actions-lua@v13 | |
| with: | |
| luaVersion: "luajit" | |
| - name: Generate docs | |
| run: luajit "${RUNNER_TEMP}/docgen/scripts/generate-api-docs.lua" types docs | |
| - name: Format docs | |
| run: npx --yes prettier@3.8.3 --write "docs/**/*.md" | |
| - name: Open docs PR | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| commit-message: "docs: generate API docs" | |
| title: "docs: generate API docs" | |
| body: "Generate and format API docs from LuaLS type annotations." | |
| branch: automation/generate-docs | |
| add-paths: | | |
| docs |