Skip to content

Update README.md

Update README.md #11

Workflow file for this run

name: Update Table of Contents
on:
push:
branches:
- main # Change this to your main branch name if different
paths:
- 'README.md'
jobs:
update-toc:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2 # is a GitHub Actions community-maintained action that you can use in your workflows to check out your repository's code on the runner machine where the workflow is executed. The @v2 refers to a specific release version of the action (action at version v2). The v2 version tag represents a specific release version of the actions/checkout action. This version is often used. The purpose of this action is to clone or checkout the repository's code into the working directory of the GitHub Actions runner machine. When GitHub Actions workflows run, they start in a clean environment without the code of your repository. The actions/checkout action ensures that the code is available for the subsequent steps in the workflow.
- name: Run doctoc Docker Container
run: docker run --rm -v "$(pwd)":/app peterdavehello/npm-doctoc doctoc /app/README.md
- name: Check if README was modified
id: check-changes
run: |
git diff --exit-code README.md
- name: Commit and Push Changes
if: steps.check-changes.outputs.result == '1'
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]" # you can use [email protected] as the email address in the git config for GitHub Actions workflows. This email address is commonly used in automated workflows, and GitHub recognizes it as a generic or default email address associated with actions.
git add README.md
git commit -m "Update Table of Contents"
git push