From 91a2b63c8086e5779f92575558a9f8546d4d20c5 Mon Sep 17 00:00:00 2001 From: George <31376482+george-gca@users.noreply.github.com> Date: Mon, 14 Apr 2025 15:39:55 -0300 Subject: [PATCH] Created GitHub action to update TOCs (#3132) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: George Araújo --- .github/workflows/update-tocs.yml | 50 +++++++++++++++++++++++++++++++ CUSTOMIZE.md | 5 ++++ FAQ.md | 19 ++---------- INSTALL.md | 20 ++----------- README.md | 34 ++------------------- 5 files changed, 61 insertions(+), 67 deletions(-) create mode 100644 .github/workflows/update-tocs.yml diff --git a/.github/workflows/update-tocs.yml b/.github/workflows/update-tocs.yml new file mode 100644 index 0000000..9e08510 --- /dev/null +++ b/.github/workflows/update-tocs.yml @@ -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 diff --git a/CUSTOMIZE.md b/CUSTOMIZE.md index ce40b6a..40f6aa2 100644 --- a/CUSTOMIZE.md +++ b/CUSTOMIZE.md @@ -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 + + + + ## Project structure The project is structured as follows, focusing on the main components that you will need to modify: diff --git a/FAQ.md b/FAQ.md index c3d345d..b37b2f8 100644 --- a/FAQ.md +++ b/FAQ.md @@ -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) + + --- diff --git a/INSTALL.md b/INSTALL.md index 3cbc5b1..d60b04c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -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) + + # Installing and Deploying diff --git a/README.md b/README.md index aa8faa6..0ab0382 100644 --- a/README.md +++ b/README.md @@ -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) + + ## Getting started