Skip to content

Add link checker

Add link checker #7

Workflow file for this run

name: Check Links
on:
pull_request: {}
jobs:
build-and-test-links:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# If your Hugo theme is a submodule, this ensures it gets pulled
submodules: true
- name: Read hugo version
id: hugo-version
run: |
HUGO_VERSION=$(grep 'HUGO_VERSION' netlify.toml | sed -E 's/.*=\s*"([^"]+)".*/\1/')
echo ${HUGO_VERSION}
echo "HUGO_VERSION=${HUGO_VERSION}" >> "${GITHUB_OUTPUT}"
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '${{ steps.hugo-version.outputs.HUGO_VERSION }}'
# If you have a custom install step for themes beyond submodules, do it here
# For example, if your theme is not a submodule but you need to download it:
# - name: Install Theme
# run: |
# git clone https://github.com/username/your-hugo-theme.git themes/your-hugo-theme
- name: Install Requirements
run: |
pip install linkchecker
- name: Start server
run: hugo server
- name: Check links
run: |
linkchecker --check-extern -f .linkcheckerrc -t 1 http://localhost:8000