Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/private-toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This is not meant to be copied and is only for this repository.
name: Update README table of contents
on:
workflow_dispatch:
push:
branches:
- main
paths:
- README.md

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: write # Allows pushing commits.

steps:
- name: Check out repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
with:
persist-credentials: false

- name: Configure Git User
run: |
# This sets the name and email for the commits
git config --global user.name "github-actions[bot]"
# official github action email
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Update TOC
run: npx --yes doctoc README.md

- name: Commit and push if README changed
run: |-
git diff
git diff --quiet || (git add README.md && git commit -m "Updated README ToC")
git push
env:
# Use the standard GITHUB_TOKEN or a Custom PAT if pushing to other repos
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

# Table of Contents

<!-- START doctoc -->
<!-- END doctoc -->

# Introduction

This repository is used to store GitHub Action workflows (and other stuff) that we'll re-use in other PNC repositories
Expand Down