mirror of
https://github.com/kitspace/awesome-electronics.git
synced 2026-07-17 14:52:37 -05:00
36 lines
1.0 KiB
YAML
36 lines
1.0 KiB
YAML
name: Update Table of Contents
|
|
# for more info, see https://github.com/PeterDaveHello/docker-doctoc
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'README.md'
|
|
|
|
jobs:
|
|
update-toc:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Run doctoc Docker Container
|
|
run: docker run --rm -v "$(pwd)":/app peterdavehello/npm-doctoc doctoc --maxlevel 2 /app/README.md # run doctoc on README.md
|
|
|
|
- name: Check if README was modified
|
|
id: check-changes
|
|
continue-on-error: true # Allow non-zero exit code
|
|
run: |
|
|
git diff --exit-code README.md # if README.md was modified, it returns 1 (failure). If it wasn't modified, it returns 0 (success)
|
|
|
|
- name: Commit and Push Changes
|
|
if: steps.check-changes.outcome == 'failure'
|
|
run: |
|
|
git config --global user.name "GitHub Actions"
|
|
git config --global user.email "actions@github.com"
|
|
git add README.md
|
|
git commit -m "Update Table of Contents"
|
|
git push
|