Skip to content

Commit

Permalink
Link checks on deploy (alshedivat#2079)
Browse files Browse the repository at this point in the history
Added another GitHub action to check for broken local links on version
of the site that will be deployed.

The `broken-links` action check for broken links considering
documentation files (like INSTALLING.md) and also pages like
[_pages/about.md](https://github.com/alshedivat/al-folio/blob/master/_pages/about.md),
but it can't check for broken links when the link will be handled by
jekyll tags (like in
[_pages/blog.md](https://github.com/alshedivat/al-folio/blob/master/_pages/blog.md).

With `broken-links-site` we can check if all the links that will be used
on the final site that refer to local files are correct. Focusing only
on local files since this would end up calling too many checks for
library files, like
`https://unpkg.com/[email protected]/dist/bootstrap-table.min.css`.

---------

Signed-off-by: George Araújo <[email protected]>
  • Loading branch information
george-gca authored and Karapost committed Jul 4, 2024
1 parent e05d43d commit 5655a7e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/broken-links-site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Check for broken links on site

on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
workflow_dispatch:

permissions:
contents: write

jobs:
deploy:
# available images: https://github.com/actions/runner-images#available-images
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2.2"
bundler-cache: true
- name: Update _config.yml ⚙️
uses: fjogeleit/[email protected]
with:
commitChange: false
valueFile: "_config.yml"
changes: |
{
"giscus.repo": "${{ github.repository }}",
"baseurl": ""
}
- name: Install and Build 🔧
run: |
pip3 install --upgrade jupyter
npm install -g mermaid.cli
npm install -g purgecss
export JEKYLL_ENV=production
bundle exec jekyll build --lsi
purgecss -c purgecss.config.js
- name: Link Checker 🔗
uses: lycheeverse/[email protected]
with:
fail: true
# only check local links
args: --offline --remap '_site(/?.*)/assets/(.*) _site/assets/$2' --verbose --no-progress '_site/**/*.html'
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: deploy
name: Deploy site

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: prettier
name: Prettier code formatter

on:
push:
Expand Down

0 comments on commit 5655a7e

Please sign in to comment.