Add toc workflow #1
This file contains 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 Table of Contents | |
on: | |
push: | |
branches: | |
- main # Change this to your main branch name | |
jobs: | |
generate-toc: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install markdown-toc | |
run: npm install -g markdown-toc | |
- name: Generate TOC | |
run: markdown-toc -i README.md # Replace README.md with the name of your Markdown file | |
- name: Commit TOC changes | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git add README.md | |
git commit -m "Generate and update Table of Contents" | |
git push |