add link checking script

This commit is contained in:
Alvin Huang 2019-04-04 18:53:30 -04:00
parent aacb81a566
commit 8922fdb82e
1 changed files with 24 additions and 0 deletions

24
website/scripts/link-check.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -xe
# Install netlify-cli
sudo npm install netlify-cli -g
# Deploy site to netlify
# Assumes NETLIFY_SITE_ID and NETLIFY_AUTH_TOKEN env variables are set
output=$(netlify deploy --dir=./website/build)
# Grab deploy URL
url=$(echo "$output" | grep "Live Draft URL" | sed -E 's/.*(https:\/\/.*$)/\1/')
# Checks broken links
wget \
--delete-after \
--level inf \
--no-verbose \
--recursive \
--no-directories \
--no-host-directories \
--page-requisites \
--spider \
$url