Skip to content

Commit 4882a15

Browse files
committed
test/absolute-links: Move from GH action to shell script
Reduces the column count in the GitHub script
1 parent 389a4d2 commit 4882a15

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

.github/workflows/jekyll.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,6 @@ jobs:
2020
- name: Run tests
2121
run: ./run-tests.sh || exit 1
2222

23-
internal-links:
24-
name: "Absolute Internal Links"
25-
needs: build
26-
runs-on: ubuntu-latest
27-
steps:
28-
- name: Checkout
29-
uses: actions/checkout@v4
30-
31-
- uses: ./.github/workflows/site-workflow
32-
33-
- name: Check for internal absolute links
34-
run: bash -c "! grep -REi 'https?://(www.)?opentabletdriver.net' site/_site || exit 1"
35-
3623
html-validation:
3724
name: "Validate HTML"
3825
needs: build
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
#
3+
# usage:
4+
# ./$0 "jekyll root" "html root"
5+
#
6+
# for use in CI to ensure absolute links aren't being written to html files
7+
#
8+
set -e # exit on any error
9+
10+
if [[ -z "$1" ]]; then
11+
echo "Usage: $0 HTML_ROOT"
12+
exit 127
13+
fi
14+
15+
HTML_ROOT="$1"
16+
17+
! grep -REi 'https?://(www.)?opentabletdriver.net' \
18+
--exclude=sitemap.xml \
19+
"${HTML_ROOT}" \
20+
| grep -vE 'canonical'
21+
22+
rv="$?"
23+
24+
if [ "$rv" -eq 0 ]; then
25+
echo "OK"
26+
else
27+
echo "FAIL"
28+
fi

0 commit comments

Comments
 (0)