Skip to content

Commit c609846

Browse files
authored
Remove properly tracked config file from .gitignore & add support for skipping of link-checking (#2023)
* Remove properly tracked config file from .gitignore The file is part of the git history and is a configuration file. Fixes: #2018 * Add env. variable support * Refactoring * Really skip linkcheck if requested
1 parent de8511b commit c609846

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

Diff for: .gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
book
22

3-
# prevent accidental changes
4-
book.toml
5-
63
ci/date-check/target/
74

85
# Generated by check-in.sh

Diff for: README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,21 @@ The build files are found in the `book/html` directory.
5959
We use `mdbook-linkcheck2` to validate URLs included in our documentation.
6060
`linkcheck` will be run automatically when you build with the instructions in the section above.
6161

62+
> [!NOTE]
63+
> The link validation can be skipped by setting the following environment variable:
64+
> `SKIP_LINKCHECK=1 mdbook ...`
65+
6266
### Table of Contents
6367

6468
We use `mdbook-toc` to auto-generate TOCs for long sections. You can invoke the preprocessor by
6569
including the `<!-- toc -->` marker at the place where you want the TOC.
6670

6771
## How to fix toolstate failures
6872

69-
> **NOTE**: Currently, we do not track the rustc-dev-guide toolstate due to
70-
[spurious failures](https://github.com/rust-lang/rust/pull/71731),
71-
but we leave these instructions for when we do it again in the future.
73+
> [!NOTE]
74+
> Currently, we do not track the rustc-dev-guide toolstate due to
75+
> [spurious failures](https://github.com/rust-lang/rust/pull/71731),
76+
> but we leave these instructions for when we do it again in the future.
7277
7378
1. You will get a ping from the toolstate commit. e.g. https://github.com/rust-lang-nursery/rust-toolstate/commit/8ffa0e4c30ac9ba8546b7046e5c4ccc2b96ebdd4
7479

Diff for: ci/linkcheck.sh

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
set -e
44
set -o pipefail
55

6+
LINKCHECK_BINARY=mdbook-linkcheck2
7+
68
set_github_token() {
79
jq '.config.output.linkcheck."http-headers"."github\\.com" = ["Authorization: Bearer $GITHUB_TOKEN"]'
810
}
911

12+
if [ ! -z "$SKIP_LINKCHECK" ] ; then
13+
echo "Skipping link check."
14+
exit 0
15+
fi
16+
1017
# https://docs.github.com/en/actions/reference/environment-variables
1118
if [ "$GITHUB_EVENT_NAME" = "schedule" ] ; then # running in scheduled job
1219
FLAGS=""
@@ -32,10 +39,10 @@ else # running locally
3239
echo "Checking files changed in $COMMIT_RANGE: $CHANGED_FILES"
3340
fi
3441

35-
echo "exec mdbook-linkcheck2 $FLAGS"
42+
echo "exec $LINKCHECK_BINARY $FLAGS"
3643
if [ "$USE_TOKEN" = 1 ]; then
3744
config=$(set_github_token)
38-
exec mdbook-linkcheck2 $FLAGS <<<"$config"
45+
exec $LINKCHECK_BINARY $FLAGS <<<"$config"
3946
else
40-
exec mdbook-linkcheck2 $FLAGS
47+
exec $LINKCHECK_BINARY $FLAGS
4148
fi

0 commit comments

Comments
 (0)