-
Notifications
You must be signed in to change notification settings - Fork 420
34 lines (28 loc) · 947 Bytes
/
doctoc.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Update Table of Contents
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/docker-doctoc doctoc /app/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 "[email protected]"
git add README.md
git commit -m "Update Table of Contents"
git push