From 8a69351160ebad6ae856e96dd18389db5667f095 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 24 Jul 2024 13:54:36 +0200 Subject: [PATCH 1/4] Remove properly tracked config file from .gitignore The file is part of the git history and is a configuration file. Fixes: #2018 --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 96034e514..160c5f0fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,5 @@ book -# prevent accidental changes -book.toml - ci/date-check/target/ # Generated by check-in.sh From f5e11cd345dc8f26f0661e4478df830fa13949fe Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Sat, 27 Jul 2024 09:38:44 +0200 Subject: [PATCH 2/4] Add env. variable support --- README.md | 11 ++++++++--- ci/linkcheck.sh | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 599de487b..d32d2386c 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,10 @@ The build files are found in the `book/html` directory. 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. +> [!NOTE] +> The link validation can be skipped by setting the following environment variable: +> `SKIP_LINKCHECK=1 mdbook ...` + ### Table of Contents We use `mdbook-toc` to auto-generate TOCs for long sections. You can invoke the preprocessor by @@ -66,9 +70,10 @@ including the `` marker at the place where you want the TOC. ## How to fix toolstate failures -> **NOTE**: Currently, we do not track the rustc-dev-guide toolstate due to -[spurious failures](https://github.com/rust-lang/rust/pull/71731), -but we leave these instructions for when we do it again in the future. +> [!NOTE] +> Currently, we do not track the rustc-dev-guide toolstate due to +> [spurious failures](https://github.com/rust-lang/rust/pull/71731), +> but we leave these instructions for when we do it again in the future. 1. You will get a ping from the toolstate commit. e.g. https://github.com/rust-lang-nursery/rust-toolstate/commit/8ffa0e4c30ac9ba8546b7046e5c4ccc2b96ebdd4 diff --git a/ci/linkcheck.sh b/ci/linkcheck.sh index b3d8a4444..33467d52e 100755 --- a/ci/linkcheck.sh +++ b/ci/linkcheck.sh @@ -7,6 +7,11 @@ set_github_token() { jq '.config.output.linkcheck."http-headers"."github\\.com" = ["Authorization: Bearer $GITHUB_TOKEN"]' } +if [ ! -z "$SKIP_LINKCHECK" ] ; then + echo "Skipping link check." + exec mdbook-linkcheck -f "" +fi + # https://docs.github.com/en/actions/reference/environment-variables if [ "$GITHUB_EVENT_NAME" = "schedule" ] ; then # running in scheduled job FLAGS="" From 7c88005bb0d1682b73cafcaf6e1de2b9f26e390f Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Sun, 29 Dec 2024 20:23:24 +0100 Subject: [PATCH 3/4] Refactoring --- ci/linkcheck.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ci/linkcheck.sh b/ci/linkcheck.sh index 33467d52e..76505ea7d 100755 --- a/ci/linkcheck.sh +++ b/ci/linkcheck.sh @@ -3,13 +3,15 @@ set -e set -o pipefail +LINKCHECK_BINARY=mdbook-linkcheck2 + set_github_token() { jq '.config.output.linkcheck."http-headers"."github\\.com" = ["Authorization: Bearer $GITHUB_TOKEN"]' } if [ ! -z "$SKIP_LINKCHECK" ] ; then echo "Skipping link check." - exec mdbook-linkcheck -f "" + exec $LINKCHECK_BINARY -f "" fi # https://docs.github.com/en/actions/reference/environment-variables @@ -37,10 +39,10 @@ else # running locally echo "Checking files changed in $COMMIT_RANGE: $CHANGED_FILES" fi -echo "exec mdbook-linkcheck2 $FLAGS" +echo "exec $LINKCHECK_BINARY $FLAGS" if [ "$USE_TOKEN" = 1 ]; then config=$(set_github_token) - exec mdbook-linkcheck2 $FLAGS <<<"$config" + exec $LINKCHECK_BINARY $FLAGS <<<"$config" else - exec mdbook-linkcheck2 $FLAGS + exec $LINKCHECK_BINARY $FLAGS fi From ed761c7a0cb3105712fe3c6424416e9f3357519e Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Sun, 29 Dec 2024 22:12:48 +0100 Subject: [PATCH 4/4] Really skip linkcheck if requested --- ci/linkcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/linkcheck.sh b/ci/linkcheck.sh index 76505ea7d..9b06f67fc 100755 --- a/ci/linkcheck.sh +++ b/ci/linkcheck.sh @@ -11,7 +11,7 @@ set_github_token() { if [ ! -z "$SKIP_LINKCHECK" ] ; then echo "Skipping link check." - exec $LINKCHECK_BINARY -f "" + exit 0 fi # https://docs.github.com/en/actions/reference/environment-variables