Skip to content

Commit

Permalink
Adding link checking GitHub workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Nate W <[email protected]>
  • Loading branch information
nate-double-u committed Oct 18, 2024
1 parent 1f6553a commit a11eda5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Adapted from @chalin's work on https://github.com/chalin/docsy-starter

name: Links

on:
merge_group:
pull_request:
push: { branches: [main] }

jobs:
build-and-check-links:
name: BUILD and CHECK LINKS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Create NPM cache-hash input file
run: |
mkdir -p tmp
jq '{devDependencies, engines, gitHubActionCacheKey}' package.json > tmp/package-ci.json
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: tmp/package-ci.json

- run: npm install --omit=optional

- run: npm run check:links
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{
"scripts": {
"_build": "hugo --cleanDestinationDir -e dev -DFE",
"_check-links": "make check-links",
"__check:links": "make --keep-going check-links",
"_check:links": "HTMLTEST_ARGS='--log-level 1 --skip-external' npm run __check:links",
"_check:links--warn": "npm run _check:links || (echo; echo 'WARNING: see link-checker output for issues.'; echo)",
"_serve:hugo": "hugo serve -DFE --minify",
"_serve": "netlify dev -c \"npm run _serve:hugo\" --framework hugo",
"build:preview": "set -x && npm run _build -- --minify --baseURL \"${DEPLOY_PRIME_URL:-/}\"",
"build:production": "hugo --cleanDestinationDir --minify",
"build": "npm run _build",
"check-links:all": "HTMLTEST_ARGS= npm run _check-links",
"check-links": "npm run _check-links",
"check:links:all": "HTMLTEST_ARGS= npm run _check:links",
"check:links": "npm run _check:links",
"clean": "make clean",
"postbuild:preview": "npm run _check-links",
"postbuild:production": "npm run _check-links",
"precheck-links:all": "npm run build",
"precheck-links": "npm run build",
"postbuild:preview": "npm run _check:links--warn",
"postbuild:production": "npm run _check:links--warn",
"precheck:links:all": "npm run build",
"precheck:links": "npm run build",
"serve:hugo": "npm run _serve:hugo",
"serve": "npm run _serve",
"test": "npm run check-links"
"test": "npm run check:links"
},
"devDependencies": {
"bulma": "^0.8.2",
Expand Down

0 comments on commit a11eda5

Please sign in to comment.