From 8922fdb82ef9902fdd63320dc99766c9e5206455 Mon Sep 17 00:00:00 2001 From: Alvin Huang Date: Thu, 4 Apr 2019 18:53:30 -0400 Subject: [PATCH] add link checking script --- website/scripts/link-check.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 website/scripts/link-check.sh diff --git a/website/scripts/link-check.sh b/website/scripts/link-check.sh new file mode 100755 index 000000000..3073324c3 --- /dev/null +++ b/website/scripts/link-check.sh @@ -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