From 03d24e42e9d90e046837f01786f02b4de75e7b40 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 20 Nov 2020 15:35:43 +0000 Subject: [PATCH] test: test preview sites for broken links (#1007) * test: test preview sites for broken links * fix: ignore gifs too * test: add test for `_redirects` file * ci: implement preliminary workflow * fix: rename folder to `lambda` * ci: make script executable * chore: indicate code review together Co-authored-by: Debbie O'Brien Co-authored-by: Debbie O'Brien --- .github/bin/update-status.sh | 24 ++ .github/workflows/deployment.yml | 37 ++++ .github/workflows/main.yml | 10 + components/templates/home/HomeWelcome.vue | 10 +- lambda/webhook.js | 29 +++ package.json | 4 + pages/docs/2.x/_book/_slug.vue | 12 +- pages/examples/_slug.vue | 12 +- pages/themes.vue | 2 +- scripts/check-redirects.js | 38 ++++ scripts/crawl.js | 104 +++++++++ yarn.lock | 255 +++++++++++++++++++++- 12 files changed, 510 insertions(+), 27 deletions(-) create mode 100755 .github/bin/update-status.sh create mode 100644 .github/workflows/deployment.yml create mode 100644 lambda/webhook.js create mode 100644 scripts/check-redirects.js create mode 100644 scripts/crawl.js diff --git a/.github/bin/update-status.sh b/.github/bin/update-status.sh new file mode 100755 index 0000000000..256cf9807a --- /dev/null +++ b/.github/bin/update-status.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +STATE=$(echo $1 | tr '[:upper:]' '[:lower:]') +CONTEXT=$2 +DESCRIPTION=$3 +GITHUB_URL="https://github.com" +GITHUB_API_URL="https://api.github.com" + +echo "Updating status to ${STATE} for ${CONTEXT} with description ${DESCRIPTION}." + +curl --silent --show-error --fail \ + --trace ./${CONTEXT}.log \ + -X POST "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA}" \ + -H "Authorization: token ${GITHUB_TOKEN}" \ + -H "Content-Type: text/json; charset=utf-8" \ + -d @- < -