Skip to content

Commit 56e4da1

Browse files
committed
Make it easier to run lychee locally
1 parent cb27e56 commit 56e4da1

File tree

4 files changed

+33
-8
lines changed

4 files changed

+33
-8
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# this file exists so that Renovate can auto-update docker image versions that are then used elsewhere
2+
3+
FROM lycheeverse/lychee:sha-2aa22f8@sha256:2e3786630482c41f9f2dd081e06d7da1c36d66996e8cf6573409b8bc418d48c4 AS lychee

.github/scripts/lychee.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
export MSYS_NO_PATHCONV=1 # for Git Bash on Windows
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
LYCHEE_CONFIG="$SCRIPT_DIR/../../lychee.toml"
9+
DEPENDENCIES_DOCKERFILE="$SCRIPT_DIR/dependencies.dockerfile"
10+
11+
# Extract lychee version from dependencies.dockerfile
12+
LYCHEE_VERSION=$(grep "FROM lycheeverse/lychee:" "$DEPENDENCIES_DOCKERFILE" | sed 's/.*FROM lycheeverse\/lychee:\([^ ]*\).*/\1/')
13+
14+
# Build the lychee command with optional GitHub token
15+
CMD="lycheeverse/lychee:$LYCHEE_VERSION --verbose --config ./lychee.toml"
16+
17+
# Add GitHub token if available
18+
if [[ -n "$GITHUB_TOKEN" ]]; then
19+
CMD="$CMD --github-token $GITHUB_TOKEN"
20+
fi
21+
22+
# Add the target directory
23+
CMD="$CMD ."
24+
25+
# Run lychee with TTY allocation and proper signal handling for Ctrl+C
26+
exec docker run --rm -it --init -v "$(dirname "$LYCHEE_CONFIG")":/data -w /data $CMD

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1414

15-
- uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332 # v2.4.1
16-
with:
17-
args: >
18-
--config ./lychee.toml
19-
--github-token ${{ github.token }}
20-
.
15+
- name: Run lychee link checker
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
run: ./.github/scripts/lychee.sh

lychee.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,3 @@ exclude = [
1717
'^https://softwareengineering.stackexchange.com/questions/29727.*',
1818
'^https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/io/opentelemetry/$',
1919
]
20-
21-

0 commit comments

Comments
 (0)