Created GitHub action to update TOCs (#3132)

Signed-off-by: George Araújo <george.gcac@gmail.com>
This commit is contained in:
George 2025-04-14 15:39:55 -03:00 committed by GitHub
parent 15fad29f23
commit 91a2b63c80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 61 additions and 67 deletions

50
.github/workflows/update-tocs.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: Update TOCs
# This workflow automatically updates the Table of Contents (TOC) in markdown files
on:
push:
branches:
- main
- master
paths:
- "*.md"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46
with:
files: ./*.md
- name: Updated toc on all markdown changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
curl https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc -o gh-md-toc
chmod a+x gh-md-toc
for file in ${ALL_CHANGED_FILES}; do
# Check if the file is a markdown file
if [[ "$file" != *.md ]]; then
continue
fi
./gh-md-toc --insert --no-backup --hide-footer $file
done
rm gh-md-toc
- name: Commit changes
if: steps.changed-files.outputs.any_changed == 'true'
uses: stefanzweifel/git-auto-commit-action@v5.0.1
with:
commit_message: Auto update markdown TOC

View File

@ -2,6 +2,11 @@
Here we will give you some tips on how to customize the website. One important thing to note is that **ALL** the changes you make should be done on the **main** branch of your repository. The `gh-pages` branch is automatically overwritten every time you make a change to the main branch.
## Table of Contents
<!--ts-->
<!--te-->
## Project structure
The project is structured as follows, focusing on the main components that you will need to modify:

19
FAQ.md
View File

@ -2,23 +2,8 @@
Here are some frequently asked questions. If you have a different question, please check if it was not already answered in the Q&A section of the [GitHub Discussions](https://github.com/alshedivat/al-folio/discussions/categories/q-a). If not, feel free to ask a new question there.
- [Frequently Asked Questions](#frequently-asked-questions)
- [After I create a new repository from this template and setup the repo, I get a deployment error. Isn't the website supposed to correctly deploy automatically?](#after-i-create-a-new-repository-from-this-template-and-setup-the-repo-i-get-a-deployment-error-isnt-the-website-supposed-to-correctly-deploy-automatically)
- [I am using a custom domain (e.g., `foo.com`). My custom domain becomes blank in the repository settings after each deployment. How do I fix that?](#i-am-using-a-custom-domain-eg-foocom-my-custom-domain-becomes-blank-in-the-repository-settings-after-each-deployment-how-do-i-fix-that)
- [My webpage works locally. But after deploying, it fails to build and throws `Unknown tag 'toc'`. How do I fix that?](#my-webpage-works-locally-but-after-deploying-it-fails-to-build-and-throws-unknown-tag-toc-how-do-i-fix-that)
- [My webpage works locally. But after deploying, it is not displayed correctly (CSS and JS are not loaded properly). How do I fix that?](#my-webpage-works-locally-but-after-deploying-it-is-not-displayed-correctly-css-and-js-are-not-loaded-properly-how-do-i-fix-that)
- [Atom feed doesn't work. Why?](#atom-feed-doesnt-work-why)
- [My site doesn't work when I enable `related_blog_posts`. Why?](#my-site-doesnt-work-when-i-enable-related_blog_posts-why)
- [When trying to deploy, it's asking for github login credentials, which github disabled password authentication and it exits with an error. How to fix?](#when-trying-to-deploy-its-asking-for-github-login-credentials-which-github-disabled-password-authentication-and-it-exits-with-an-error-how-to-fix)
- [When I manually run the Lighthouse Badger workflow, it fails with `Error: Input required and not supplied: token`. How do I fix that?](#when-i-manually-run-the-lighthouse-badger-workflow-it-fails-with-error-input-required-and-not-supplied-token-how-do-i-fix-that)
- [My code runs fine locally, but when I create a commit and submit it, it fails with `prettier code formatter workflow run failed for main branch`. How do I fix that?](#my-code-runs-fine-locally-but-when-i-create-a-commit-and-submit-it-it-fails-with-prettier-code-formatter-workflow-run-failed-for-main-branch-how-do-i-fix-that)
- [After I update my site with some new content, even a small change, the GitHub action throws an error or displays a warning. What happened?](#after-i-update-my-site-with-some-new-content-even-a-small-change-the-github-action-throws-an-error-or-displays-a-warning-what-happened)
- [I am trying to deploy my site, but it fails with `Could not find gem 'jekyll-diagrams' in locally installed gems`. How do I fix that?](#i-am-trying-to-deploy-my-site-but-it-fails-with-could-not-find-gem-jekyll-diagrams-in-locally-installed-gems-how-do-i-fix-that)
- [How can I update Academicons version on the template](#how-can-i-update-academicons-version-on-the-template)
- [How can I update Font Awesome version on the template](#how-can-i-update-font-awesome-version-on-the-template)
- [How can I update Tabler Icons version on the template](#how-can-i-update-tabler-icons-version-on-the-template)
- [What do all these GitHub actions/workflows mean?](#what-do-all-these-github-actionsworkflows-mean)
- [How can I use Google Search Console ID on the template?](#how-can-i-use-google-search-console-id-on-the-template)
<!--ts-->
<!--te-->
---

View File

@ -1,23 +1,7 @@
# Table of Contents
- [Table of Contents](#table-of-contents)
- [Installing and Deploying](#installing-and-deploying)
- [Recommended Approach](#recommended-approach)
- [Local setup on Windows](#local-setup-on-windows)
- [Local setup using Docker (Recommended)](#local-setup-using-docker-recommended)
- [Build your own docker image](#build-your-own-docker-image)
- [Have Bugs on Docker Image?](#have-bugs-on-docker-image)
- [Local Setup with Development Containers](#local-setup-with-development-containers)
- [Local Setup (Legacy, no longer supported)](#local-setup-legacy-no-longer-supported)
- [Deployment](#deployment)
- [For personal and organization webpages](#for-personal-and-organization-webpages)
- [For project pages](#for-project-pages)
- [Enabling automatic deployment](#enabling-automatic-deployment)
- [Manual deployment to GitHub Pages](#manual-deployment-to-github-pages)
- [Deploy on Netlify](#deploy-on-netlify)
- [Deployment to another hosting server (non GitHub Pages)](#deployment-to-another-hosting-server-non-github-pages)
- [Deployment to a separate repository (advanced users only)](#deployment-to-a-separate-repository-advanced-users-only)
- [Upgrading from a previous version](#upgrading-from-a-previous-version)
<!--ts-->
<!--te-->
# Installing and Deploying

View File

@ -224,38 +224,8 @@ Run the test yourself: [Google Lighthouse PageSpeed Insights](https://pagespeed.
## Table Of Contents
- [al-folio](#al-folio)
- [User community](#user-community)
- [Lighthouse PageSpeed Insights](#lighthouse-pagespeed-insights)
- [Desktop](#desktop)
- [Mobile](#mobile)
- [Table Of Contents](#table-of-contents)
- [Getting started](#getting-started)
- [Installing and Deploying](#installing-and-deploying)
- [Customizing](#customizing)
- [Features](#features)
- [Light/Dark Mode](#lightdark-mode)
- [CV](#cv)
- [People](#people)
- [Publications](#publications)
- [Collections](#collections)
- [Layouts](#layouts)
- [The iconic style of Distill](#the-iconic-style-of-distill)
- [Full support for math \& code](#full-support-for-math--code)
- [Photos, Audio, Video and more](#photos-audio-video-and-more)
- [Other features](#other-features)
- [GitHub's repositories and user stats](#githubs-repositories-and-user-stats)
- [Theming](#theming)
- [Social media previews](#social-media-previews)
- [Atom (RSS-like) Feed](#atom-rss-like-feed)
- [Related posts](#related-posts)
- [Code quality checks](#code-quality-checks)
- [FAQ](#faq)
- [Contributing](#contributing)
- [Maintainers](#maintainers)
- [All Contributors](#all-contributors)
- [Star History](#star-history)
- [License](#license)
<!--ts-->
<!--te-->
## Getting started