From a4e98268bbe8eb3dd0ad3fac7ea05156de74bd56 Mon Sep 17 00:00:00 2001 From: Martin Liška Date: Sun, 29 Dec 2024 22:23:49 +0100 Subject: 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 --- src/doc/rustc-dev-guide/ci/linkcheck.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/doc/rustc-dev-guide/ci') diff --git a/src/doc/rustc-dev-guide/ci/linkcheck.sh b/src/doc/rustc-dev-guide/ci/linkcheck.sh index b3d8a444402..9b06f67fc9f 100755 --- a/src/doc/rustc-dev-guide/ci/linkcheck.sh +++ b/src/doc/rustc-dev-guide/ci/linkcheck.sh @@ -3,10 +3,17 @@ 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." + exit 0 +fi + # https://docs.github.com/en/actions/reference/environment-variables if [ "$GITHUB_EVENT_NAME" = "schedule" ] ; then # running in scheduled job FLAGS="" @@ -32,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 -- cgit 1.4.1-3-g733a5