1
Fork 0

Start using mdbook-linkcheck2 (#2103)

This commit is contained in:
Martin Liška 2024-12-29 00:00:32 +01:00 committed by GitHub
parent 1a99d3bafa
commit e19542f0a9
3 changed files with 8 additions and 14 deletions

View file

@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: 0.4.21
MDBOOK_LINKCHECK_VERSION: 0.7.6
MDBOOK_LINKCHECK2_VERSION: 0.8.1
MDBOOK_MERMAID_VERSION: 0.12.6
MDBOOK_TOC_VERSION: 0.11.2
DEPLOY_DIR: book/html
@ -33,7 +33,7 @@ jobs:
with:
path: |
~/.cargo/bin
key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }}
key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK2_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }}
- name: Cache linkcheck
uses: actions/cache@v4
@ -52,7 +52,7 @@ jobs:
if: steps.mdbook-cache.outputs.cache-hit != 'true'
run: |
cargo install mdbook --version ${{ env.MDBOOK_VERSION }}
cargo install mdbook-linkcheck --version ${{ env.MDBOOK_LINKCHECK_VERSION }}
cargo install mdbook-linkcheck2 --version ${{ env.MDBOOK_LINKCHECK2_VERSION }}
cargo install mdbook-toc --version ${{ env.MDBOOK_TOC_VERSION }}
cargo install mdbook-mermaid --version ${{ env.MDBOOK_MERMAID_VERSION }}

View file

@ -43,7 +43,7 @@ rustdocs][rustdocs].
To build a local static HTML site, install [`mdbook`](https://github.com/rust-lang/mdBook) with:
```
> cargo install mdbook mdbook-linkcheck mdbook-toc mdbook-mermaid
> cargo install mdbook mdbook-linkcheck2 mdbook-toc mdbook-mermaid
```
and execute the following command in the root of the repository:
@ -56,7 +56,7 @@ The build files are found in the `book/html` directory.
### Link Validations
We use `mdbook-linkcheck` to validate URLs included in our documentation.
We use `mdbook-linkcheck2` to validate URLs included in our documentation.
`linkcheck` will be run automatically when you build with the instructions in the section above.
### Table of Contents

View file

@ -14,9 +14,6 @@ if [ "$GITHUB_EVENT_NAME" = "schedule" ] ; then # running in scheduled job
echo "Doing full link check."
elif [ "$GITHUB_EVENT_NAME" = "pull_request" ] ; then # running in PR CI build
echo "*** WARNING: linkcheck temporarily disabled due to bugs ***"
exit 0
if [ -z "$BASE_SHA" ]; then
echo "error: unexpected state: BASE_SHA must be non-empty in CI"
exit 1
@ -28,9 +25,6 @@ elif [ "$GITHUB_EVENT_NAME" = "pull_request" ] ; then # running in PR CI build
echo "Checking files changed since $BASE_SHA: $CHANGED_FILES"
else # running locally
echo "*** WARNING: linkcheck temporarily disabled due to bugs ***"
exit 0
COMMIT_RANGE=master...
CHANGED_FILES=$(git diff --name-only $COMMIT_RANGE | sed 's#^src/##' | tr '\n' ' ')
FLAGS="-f $CHANGED_FILES"
@ -38,10 +32,10 @@ else # running locally
echo "Checking files changed in $COMMIT_RANGE: $CHANGED_FILES"
fi
echo "exec mdbook-linkcheck $FLAGS"
echo "exec mdbook-linkcheck2 $FLAGS"
if [ "$USE_TOKEN" = 1 ]; then
config=$(set_github_token)
exec mdbook-linkcheck $FLAGS <<<"$config"
exec mdbook-linkcheck2 $FLAGS <<<"$config"
else
exec mdbook-linkcheck $FLAGS
exec mdbook-linkcheck2 $FLAGS
fi