Skip to content

Commit b953de4

Browse files
authored
Aligns the link checking with the upstream instrumentation repo (#1037)
* this aligns the link checking with the upstream instrumentation repo * Update .github/workflows/build.yaml
1 parent 652b1a2 commit b953de4

9 files changed

Lines changed: 90 additions & 60 deletions
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/link-check.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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 $(basename "$LYCHEE_CONFIG")"
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+
# Determine if we should allocate a TTY
26+
DOCKER_FLAGS="--rm --init"
27+
if [[ -t 0 ]]; then
28+
DOCKER_FLAGS="$DOCKER_FLAGS -it"
29+
else
30+
DOCKER_FLAGS="$DOCKER_FLAGS -i"
31+
fi
32+
33+
# Run lychee with proper signal handling
34+
# shellcheck disable=SC2086
35+
exec docker run $DOCKER_FLAGS -v "$(dirname "$LYCHEE_CONFIG")":/data -w /data $CMD

.github/scripts/markdown-link-check-config.json

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

.github/scripts/markdown-link-check-with-retry.sh

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

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
markdown-link-check:
4040
# release branches are excluded to avoid unnecessary maintenance
4141
if: ${{ !startsWith(github.ref_name, 'release/') }}
42-
uses: ./.github/workflows/reusable-markdown-link-check.yml
42+
uses: ./.github/workflows/reusable-link-check.yml
4343

4444
workflow-notification:
4545
permissions: # required by the reusable workflow
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Reusable - Link check
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
link-check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
14+
15+
- name: Link check
16+
env:
17+
GITHUB_TOKEN: ${{ github.token }}
18+
run: ./.github/scripts/link-check.sh

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

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

.lychee.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
timeout = 30
2+
retry_wait_time = 5
3+
max_retries = 6
4+
max_concurrency = 4
5+
6+
# Check link anchors
7+
include_fragments = true
8+
9+
# excluding links to pull requests and issues is done for performance
10+
exclude = [
11+
"^http://localhost:16686/$",
12+
'^https://github.com/open-telemetry/opentelemetry-android/(issues|pull)/\d+$',
13+
"^https://maven-badges.sml.io/maven-central/io.opentelemetry.android/.*$",
14+
"^https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/.*$",
15+
]

reusable-link-check.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Reusable - Link check
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
link-check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
14+
15+
- name: Link check
16+
env:
17+
GITHUB_TOKEN: ${{ github.token }}
18+
run: ./.github/scripts/link-check.sh

0 commit comments

Comments
 (0)