Apply suggestions from code review #677
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
on: [push] | |
jobs: | |
pre-commit-checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository and submodules | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup Python | |
uses: actions/setup-python@v3 | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: 'latest' | |
extended: true | |
- name: Run pre-commit checks | |
uses: pre-commit/[email protected] | |
html-proofer-internal-links: | |
name: "HTML proofer internal links" | |
runs-on: ubuntu-latest | |
needs: pre-commit-checks | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: 'latest' | |
extended: true | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: head | |
- name: Install html-proofer | |
run: gem install html-proofer -v '~>5' | |
- name: Build | |
run: hugo --minify | |
- name: Run html-proofer | |
# swap URLs | |
# - adjust for base URL (REG-handbook) | |
# Ignore internal links to base URL | |
# Only check internal links | |
# Ignore contributors table, which has many links we don't control | |
run: | | |
htmlproofer ./public \ | |
--disable-external \ | |
--swap-urls "^/REG-handbook/:/" \ | |
--ignore-urls '/REG-handbook' \ | |
--ignore-files './public/docs/contributors/index.html' | |
html-proofer-external-links: | |
name: "HTML proofer external links" | |
runs-on: ubuntu-latest | |
needs: pre-commit-checks | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: 'latest' | |
extended: true | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: head | |
- name: Install html-proofer | |
run: gem install html-proofer -v '~>5' | |
- name: Build | |
run: hugo --minify | |
- name: Run html-proofer | |
# swap URLs | |
# - adjust for internal links with fqdn (https://alan-turing-institute.github.io/REG-handbook) | |
# - adjust for base URL (REG-handbook) | |
# - Adjust edit and tree paths on GitHub to current branch (*/edit/main, */tree/main) | |
# Only check external and internal links | |
# Ignore contributors table, which has many links we don't control | |
run: | | |
htmlproofer ./public \ | |
--swap-urls "^https\://alan-turing-institute.github.io/REG-handbook/:/,^/REG-handbook/:/,/edit/main:/edit/$(git branch --show-current)" \ | |
--ignore-urls '/REG-handbook,/turing.ac.uk/,/github.com/,/docs.github.com/,/twitter.com/' \ | |
--ignore-files './public/docs/contributors/index.html' |