run-htmltest-nightly #114
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
# Based on https://robb.sh/posts/check-links-in-hugo-with-htmltest/ | |
# Run htmltest link checker on generated HTML output in dist/ | |
# | |
# https://github.com/wjdp/htmltest | |
name: run-htmltest-nightly | |
on: | |
schedule: | |
- cron: "0 1 * * *" # every day at 01:00 | |
jobs: | |
htmltest: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: Hugo setup | |
uses: peaceiris/[email protected] | |
with: | |
hugo-version: "0.110.0" | |
extended: true | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
cache: "npm" | |
# The action defaults to search for the dependency file (package-lock.json, | |
# npm-shrinkwrap.json or yarn.lock) in the repository root, and uses its | |
# hash as a part of the cache key. | |
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data | |
cache-dependency-path: "**/package-lock.json" | |
- name: Run NPM | |
run: npm ci | |
- name: BuildDocsSite | |
# Put the build output where the following steps can find it | |
# GITHUB_WORKSPACE | |
run: hugo server --verbose --destination $GITHUB_WORKPLACE/dist | |
- name: Test HTML | |
# https://github.com/wjdp/htmltest-action/ | |
# Don't fail on broken links | |
continue-on-error: true | |
uses: wjdp/htmltest-action@master | |
with: | |
# For consistency, use the same config file as for local builds | |
config: .htmltest.yml | |
- name: Archive htmltest results | |
uses: actions/upload-artifact@v2 | |
# Note: Set ACTIONS_RUNTIME_TOKEN env variable to test with nektos/act | |
with: | |
name: htmltest-report | |
path: tmp/.htmltest/htmltest.log | |
retention-days: 21 # Default is 90 days |