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
This commit is contained in:
parent
de8511be8c
commit
c609846601
|
|
@ -1,8 +1,5 @@
|
||||||
book
|
book
|
||||||
|
|
||||||
# prevent accidental changes
|
|
||||||
book.toml
|
|
||||||
|
|
||||||
ci/date-check/target/
|
ci/date-check/target/
|
||||||
|
|
||||||
# Generated by check-in.sh
|
# Generated by check-in.sh
|
||||||
|
|
|
||||||
11
README.md
11
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.
|
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.
|
`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
|
### Table of Contents
|
||||||
|
|
||||||
We use `mdbook-toc` to auto-generate TOCs for long sections. You can invoke the preprocessor by
|
We use `mdbook-toc` to auto-generate TOCs for long sections. You can invoke the preprocessor by
|
||||||
|
|
@ -66,9 +70,10 @@ including the `<!-- toc -->` marker at the place where you want the TOC.
|
||||||
|
|
||||||
## How to fix toolstate failures
|
## How to fix toolstate failures
|
||||||
|
|
||||||
> **NOTE**: Currently, we do not track the rustc-dev-guide toolstate due to
|
> [!NOTE]
|
||||||
[spurious failures](https://github.com/rust-lang/rust/pull/71731),
|
> Currently, we do not track the rustc-dev-guide toolstate due to
|
||||||
but we leave these instructions for when we do it again in the future.
|
> [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
|
1. You will get a ping from the toolstate commit. e.g. https://github.com/rust-lang-nursery/rust-toolstate/commit/8ffa0e4c30ac9ba8546b7046e5c4ccc2b96ebdd4
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,17 @@
|
||||||
set -e
|
set -e
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
LINKCHECK_BINARY=mdbook-linkcheck2
|
||||||
|
|
||||||
set_github_token() {
|
set_github_token() {
|
||||||
jq '.config.output.linkcheck."http-headers"."github\\.com" = ["Authorization: Bearer $GITHUB_TOKEN"]'
|
jq '.config.output.linkcheck."http-headers"."github\\.com" = ["Authorization: Bearer $GITHUB_TOKEN"]'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ ! -z "$SKIP_LINKCHECK" ] ; then
|
||||||
|
echo "Skipping link check."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# https://docs.github.com/en/actions/reference/environment-variables
|
# https://docs.github.com/en/actions/reference/environment-variables
|
||||||
if [ "$GITHUB_EVENT_NAME" = "schedule" ] ; then # running in scheduled job
|
if [ "$GITHUB_EVENT_NAME" = "schedule" ] ; then # running in scheduled job
|
||||||
FLAGS=""
|
FLAGS=""
|
||||||
|
|
@ -32,10 +39,10 @@ else # running locally
|
||||||
echo "Checking files changed in $COMMIT_RANGE: $CHANGED_FILES"
|
echo "Checking files changed in $COMMIT_RANGE: $CHANGED_FILES"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "exec mdbook-linkcheck2 $FLAGS"
|
echo "exec $LINKCHECK_BINARY $FLAGS"
|
||||||
if [ "$USE_TOKEN" = 1 ]; then
|
if [ "$USE_TOKEN" = 1 ]; then
|
||||||
config=$(set_github_token)
|
config=$(set_github_token)
|
||||||
exec mdbook-linkcheck2 $FLAGS <<<"$config"
|
exec $LINKCHECK_BINARY $FLAGS <<<"$config"
|
||||||
else
|
else
|
||||||
exec mdbook-linkcheck2 $FLAGS
|
exec $LINKCHECK_BINARY $FLAGS
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue