Skip to content

Commit

Permalink
Make linkcheck2 detection automatic
Browse files Browse the repository at this point in the history
  • Loading branch information
marxin committed Jan 6, 2025
1 parent 42160c3 commit 2aa0212
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
cargo install mdbook-mermaid --version ${{ env.MDBOOK_MERMAID_VERSION }}
- name: Check build
run: ENABLE_LINKCHECK=1 mdbook build
run: mdbook build

- name: Deploy to gh-pages
if: github.event_name == 'push'
Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,8 @@ The build files are found in the `book/html` directory.
### Link Validations

We use `mdbook-linkcheck2` to validate URLs included in our documentation. Link
checking is **not** run by default locally, though it is in CI. To enable it
locally, set the environment variable `ENABLE_LINKCHECK=1` like in the
following example.

```console
$ ENABLE_LINKCHECK=1 mdbook serve
```
checking is run locally only if the `mdbook-linkcheck2` crate is installed. Otherwise,
a warning is printed to the user.

### Table of Contents

Expand Down
4 changes: 2 additions & 2 deletions ci/linkcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ set_github_token() {
jq '.config.output.linkcheck."http-headers"."github\\.com" = ["Authorization: Bearer $GITHUB_TOKEN"]'
}

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

Expand Down

0 comments on commit 2aa0212

Please sign in to comment.