Skip to content
This repository was archived by the owner on Apr 7, 2025. It is now read-only.

Commit 783dbae

Browse files
committed
script
1 parent 6e8d09f commit 783dbae

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ jobs:
3030
- run: yarn lint
3131
- run: yarn format
3232
- run: yarn cspell
33+
34+
- name: Check links
35+
- run: |
36+
gem install jekyll bundler
37+
bundler install
38+
yarn links

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"name": "glaredb.github.io",
33
"private": true,
44
"scripts": {
5-
"check:all": "yarn lint && yarn format && yarn cspell",
5+
"check:all": "yarn lint && yarn format && yarn cspell && yarn links",
66
"cspell": "cspell lint --config=cspell.json '**/*.md'",
77
"dev": "bundle exec jekyll serve",
88
"format": "prettier --check .",
99
"format:fix": "prettier --write .",
1010
"lint": "markdownlint-cli2 \"**/*.{md,mdx}\" \"!node_modules\" \"!_site\"",
1111
"lint:fix": "markdownlint-cli2-fix \"**/*.{md,mdx}\" \"!node_modules\" \"!_site\"",
12-
"links": "lychee -v http://localhost:4000"
12+
"links": "./scripts/check-links.sh"
1313
},
1414
"devDependencies": {
1515
"cspell": "^6.31.1",

scripts/check-links.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
# Spins up the docs site (on a non-default port) and runs lychee against it to
4+
# check for broken links.
5+
6+
set -e
7+
8+
bundle exec jekyll serve --port 4001 > /dev/null 2>&1 &
9+
pid=$!
10+
11+
attempts=0
12+
until curl --output /dev/null --silent --head --fail http://localhost:4001; do
13+
attempts=$((attempts+1))
14+
if [ $attempts -ge 10 ]; then
15+
echo "max attempts exceeded"
16+
exit 1
17+
fi
18+
echo "waiting for server"
19+
sleep 1
20+
done
21+
22+
lychee -v http://localhost:4001
23+
24+
kill $pid

0 commit comments

Comments
 (0)