From 0716f315740a1d0585f70856e55537b365c8f73c Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Tue, 29 Sep 2020 17:16:57 +0300 Subject: [PATCH] CI: GitCub: add On-Readme-update: add automatic TOC generation --- .github/workflows/On-Readme-update.yml | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/On-Readme-update.yml diff --git a/.github/workflows/On-Readme-update.yml b/.github/workflows/On-Readme-update.yml new file mode 100644 index 0000000..c35d8aa --- /dev/null +++ b/.github/workflows/On-Readme-update.yml @@ -0,0 +1,33 @@ +name: "On README change" + +on: + push: + branches: + - master + paths: + - "README.md" + +jobs: + + build10: + name: "Check TOC, autogenerate and commit it into the PR" + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Install doctoc + run: | + sudo npm install -g doctoc + - uses: actions/checkout@v2 + with: + # 2020-09-29: Official doc: + # "In non-push events, such as pull_request, make sure to specify the ref to checkout:' + ref: ${{ github.head_ref }} + - name: Generate the idenpotent TOC + run: | + doctoc --github --notitle README.md + - name: Commit and push changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_author: "Anton Latukha " + commit_message: "[auto] upd README TOC" + file_pattern: "README.md"