Automated markdown TOC generation with Github Actions
banzo opened this issue · 3 comments
banzo commented
Would it be possible to make this tool available trough GitHub Actions? This way when someone pushes markdown files, the action would generate the TOC and commit back the updated version of the markdown files.
Note: Maybe this project could be used to commit the updated markdown https://github.com/stefanzweifel/git-auto-commit-action
sensuikan1973 commented
This is easy, and actually I do.
on:
push:
branches: [main]
paths: ['foo.md']
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- run: |
curl https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc -o gh-md-toc
chmod a+x gh-md-toc
./gh-md-toc --insert --no-backup foo.md
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Auto update markdown TOC
(my real example is https://github.com/sensuikan1973/othello-complete-analysis/blob/main/.github/workflows/update_toc.yaml.)
ekalinin commented
Thanks for the example, @sensuikan1973 !
Do you mind if I add it into README?
sensuikan1973 commented
sure👍