Skip to content

Commit d3af90c

Browse files
committed
Add workflow to auto-update README table of contents
1 parent cab8310 commit d3af90c

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

.github/workflows/toc.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
on:
2+
push:
3+
paths: [ 'README.md' ]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: write
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 2
14+
- run: |
15+
curl https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc -o gh-md-toc
16+
chmod a+x gh-md-toc
17+
./gh-md-toc --insert --no-backup --hide-footer README.md
18+
rm gh-md-toc
19+
20+
- name: Get last commit message
21+
id: last-commit
22+
run: |
23+
echo "message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
24+
echo "author=$(git log -1 --pretty=\"%an <%ae>\")" >> $GITHUB_OUTPUT
25+
26+
- uses: stefanzweifel/git-auto-commit-action@v5
27+
with:
28+
commit_author: ${{ steps.last-commit.outputs.author }}
29+
commit_message: ${{ steps.last-commit.outputs.message }}
30+
commit_options: '--amend --no-edit'
31+
push_options: '--force'
32+
skip_fetch: true

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
# InverterChargeController
1+
## InverterChargeController
22

33
This project aims to charge the battery pack of a photovoltaic system when the energy rates are as low as possible.
44

5+
## Table of contents
6+
7+
<!--ts-->
8+
<!--te-->
9+
510
## Usage
611

712
### Setup

0 commit comments

Comments
 (0)