From bdc7282546c86a2936530adda7249a8b323b075f Mon Sep 17 00:00:00 2001 From: Felix W Date: Wed, 29 Nov 2023 17:56:25 +0100 Subject: [PATCH] Add toc workflow --- .github/workflows/generate-toc.yml | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/generate-toc.yml diff --git a/.github/workflows/generate-toc.yml b/.github/workflows/generate-toc.yml new file mode 100644 index 0000000..7b88997 --- /dev/null +++ b/.github/workflows/generate-toc.yml @@ -0,0 +1,33 @@ +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 "actions@github.com" + git add README.md + git commit -m "Generate and update Table of Contents" + git push