mirror of
https://github.com/kd9lsv/awesome-hamradio.git
synced 2024-11-28 23:28:57 -05:00
Generate Table of Contents workflow.
This commit is contained in:
parent
6e3d88d340
commit
cb3cb27580
35
.github/workflows/update-toc.yaml
vendored
Normal file
35
.github/workflows/update-toc.yaml
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
name: Update Table of Contents
|
||||
# for more info, see https://github.com/PeterDaveHello/docker-doctoc
|
||||
|
||||
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 # 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" # you can use actions@github.com 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
|
Loading…
Reference in New Issue
Block a user