Skip to content

Commit 6a3094f

Browse files
authored
More link check improvements (#2010)
1 parent 6f3a18a commit 6a3094f

File tree

5 files changed

+16
-25
lines changed

5 files changed

+16
-25
lines changed

.github/scripts/.lychee-relative.toml

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/scripts/link-check.sh

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ export MSYS_NO_PATHCONV=1 # for Git Bash on Windows
66

77
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
88
ROOT_DIR="$SCRIPT_DIR/../.."
9-
DEPENDENCIES_DOCKERFILE="$SCRIPT_DIR/dependencies.dockerfile"
9+
DEPENDENCIES_DOCKERFILE="$SCRIPT_DIR/dependencies.Dockerfile"
1010

1111
# Parse command line arguments
12-
RELATIVE_ONLY=false
13-
MODIFIED_FILES=""
12+
LOCAL_LINKS_ONLY=false
13+
TARGET=""
1414

1515
while [[ $# -gt 0 ]]; do
1616
case $1 in
17-
--relative-only)
18-
RELATIVE_ONLY=true
17+
--local-links-only)
18+
LOCAL_LINKS_ONLY=true
1919
shift
2020
;;
2121
*)
2222
# Treat any other arguments as file paths
23-
MODIFIED_FILES="$MODIFIED_FILES $1"
23+
TARGET="$TARGET $1"
2424
shift
2525
;;
2626
esac
@@ -29,26 +29,24 @@ done
2929
# Extract lychee version from dependencies.dockerfile
3030
LYCHEE_VERSION=$(grep "FROM lycheeverse/lychee:" "$DEPENDENCIES_DOCKERFILE" | sed 's/.*FROM lycheeverse\/lychee:\([^ ]*\).*/\1/')
3131

32-
# Determine target files/directories and config file
33-
TARGET="."
34-
LYCHEE_CONFIG=".github/scripts/.lychee.toml"
35-
36-
if [[ "$RELATIVE_ONLY" == "true" ]]; then
37-
LYCHEE_CONFIG=".github/scripts/.lychee-relative.toml"
38-
fi
39-
40-
if [[ -n "$MODIFIED_FILES" ]]; then
41-
TARGET="$MODIFIED_FILES"
32+
if [[ -z "$TARGET" ]]; then
33+
TARGET="."
4234
fi
4335

4436
# Build the lychee command with optional GitHub token
45-
CMD="lycheeverse/lychee:$LYCHEE_VERSION --verbose --config $LYCHEE_CONFIG"
37+
CMD="lycheeverse/lychee:$LYCHEE_VERSION --verbose --root-dir /data"
4638

4739
# Add GitHub token if available
4840
if [[ -n "$GITHUB_TOKEN" ]]; then
4941
CMD="$CMD --github-token $GITHUB_TOKEN"
5042
fi
5143

44+
if [[ "$LOCAL_LINKS_ONLY" == "true" ]]; then
45+
CMD="$CMD --scheme file --include-fragments"
46+
else
47+
CMD="$CMD --config .github/scripts/lychee-config.toml"
48+
fi
49+
5250
CMD="$CMD $TARGET"
5351

5452
# Determine if we should allocate a TTY
File renamed without changes.

.github/workflows/reusable-link-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
if: github.event_name == 'pull_request'
1919
env:
2020
GITHUB_TOKEN: ${{ github.token }}
21-
run: ./.github/scripts/link-check.sh --relative-only
21+
run: ./.github/scripts/link-check.sh --local-links-only
2222

2323
- name: Get modified files
2424
if: github.event_name == 'pull_request'

0 commit comments

Comments
 (0)