Skip to content

Commit 2aa0212

Browse files
committed
Make linkcheck2 detection automatic
1 parent 42160c3 commit 2aa0212

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
cargo install mdbook-mermaid --version ${{ env.MDBOOK_MERMAID_VERSION }}
5858
5959
- name: Check build
60-
run: ENABLE_LINKCHECK=1 mdbook build
60+
run: mdbook build
6161

6262
- name: Deploy to gh-pages
6363
if: github.event_name == 'push'

README.md

+2-7
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,8 @@ The build files are found in the `book/html` directory.
5757
### Link Validations
5858

5959
We use `mdbook-linkcheck2` to validate URLs included in our documentation. Link
60-
checking is **not** run by default locally, though it is in CI. To enable it
61-
locally, set the environment variable `ENABLE_LINKCHECK=1` like in the
62-
following example.
63-
64-
```console
65-
$ ENABLE_LINKCHECK=1 mdbook serve
66-
```
60+
checking is run locally only if the `mdbook-linkcheck2` crate is installed. Otherwise,
61+
a warning is printed to the user.
6762

6863
### Table of Contents
6964

ci/linkcheck.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ set_github_token() {
99
jq '.config.output.linkcheck."http-headers"."github\\.com" = ["Authorization: Bearer $GITHUB_TOKEN"]'
1010
}
1111

12-
if [ -z "$ENABLE_LINKCHECK" ] ; then
13-
echo "Skipping link check."
12+
if ! which $LINKCHECK_BINARY &>/dev/null && [ -z "$GITHUB_EVENT_NAME" ] ; then
13+
echo "WARNING: Skipping link check. Consider running 'cargo install $LINKCHECK_BINARY'."
1414
exit 0
1515
fi
1616

0 commit comments

Comments
 (0)