Skip to content

Add link check action #4

Add link check action

Add link check action #4

Workflow file for this run

# Workflow for building and link checking a Hugo site on PRs
name: Build and Link Check Hugo site on PRs
on:
# Runs on pull requests targeting the dev branch
pull_request:
branches: ["dev"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Default to bash
defaults:
run:
shell: bash
jobs:
# Build and Link Check job
build_and_link_check:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.128.0
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
HUGO_ENVIRONMENT: production
run: hugo --minify
- name: List files in the public directory with the HUGO build
run: ls -R public
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2
with:
args: --verbose --no-progress 'public/**/*.html'