Update README.md #2
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: Update README TOC | |
| on: | |
| push: | |
| paths: | |
| - "README.md" | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: write | |
| jobs: | |
| doctoc: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # Needed so we can push back to the same branch | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install doctoc | |
| run: npm install -g doctoc | |
| - name: Generate TOC | |
| run: | | |
| doctoc --maxlevel 4 README.md | |
| - name: Commit & push if changed | |
| run: | | |
| if git diff --quiet; then | |
| echo "No TOC changes." | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add README.md | |
| git commit -m "chore: update README TOC" | |
| git push |