Skip to content

Commit 0ddae14

Browse files
committed
chore(lint): match check-links workflow from the otel collector
1 parent 28b94af commit 0ddae14

File tree

3 files changed

+35
-42
lines changed

3 files changed

+35
-42
lines changed

.github/lychee.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
include-fragments = true
2+
3+
accept = ["200..=299", "429"]
4+
5+
exclude = [
6+
"^http(s)?://localhost",
7+
"^http(s)?://example.com",
8+
"https://docs.aws.amazon.com",
9+
"https://console.aws.amazon.com"
10+
]
11+
12+
# better to be safe and avoid failures
13+
max-retries = 6

.github/workflows/check-links.yaml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,51 @@
1-
name: "Link Check"
1+
name: check-links
22
on:
33
push:
44
branches: [main]
55
pull_request:
66

77
concurrency:
8-
group: ${{ github.workflow }}-${{ github.head_ref }}
8+
group: ${{ github.workflow }}-${{ github.ref_name }}
9+
cancel-in-progress: true
10+
11+
permissions: read-all
12+
913
jobs:
1014
changedfiles:
1115
name: changed files
1216
runs-on: ubuntu-latest
1317
env:
1418
PR_HEAD: ${{ github.event.pull_request.head.sha }}
1519
outputs:
16-
md: ${{ steps.changes.outputs.md }}
20+
files: ${{ steps.changes.outputs.files }}
1721
steps:
1822
- name: Checkout Repo
19-
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2024
with:
2125
fetch-depth: 0
2226
- name: Get changed files
2327
id: changes
2428
run: |
25-
echo "md=$(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base origin/main $PR_HEAD) $PR_HEAD | grep .md$ | xargs)" >> $GITHUB_OUTPUT
29+
files=$(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base origin/main $PR_HEAD) $PR_HEAD | grep .md$ | xargs)
30+
31+
if [ -z "$files" ] && git diff --name-only $(git merge-base origin/main $PR_HEAD) $PR_HEAD | grep -q "package.json"; then
32+
files="**/*.md"
33+
fi
2634
35+
echo "files=$files" >> $GITHUB_OUTPUT
2736
check-links:
2837
runs-on: ubuntu-latest
2938
needs: changedfiles
30-
if: ${{needs.changedfiles.outputs.md}}
39+
if: ${{needs.changedfiles.outputs.files}}
3140
steps:
3241
- name: Checkout Repo
33-
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
42+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3443
with:
3544
fetch-depth: 0
3645

37-
- name: Run markdown-link-check
38-
run: |
39-
npx --no -- markdown-link-check \
40-
--verbose \
41-
--config .github/workflows/check_links_config.json \
42-
${{needs.changedfiles.outputs.md}} \
43-
|| { echo "Check that anchor links are lowercase"; exit 1; }
46+
- name: Link Checker
47+
id: lychee
48+
uses: lycheeverse/lychee-action@f613c4a64e50d792e0b31ec34bbcbba12263c6a6
49+
with:
50+
args: "--verbose --no-progress ${{needs.changedfiles.outputs.files}} --config .github/lychee.toml"
51+
failIfEmpty: false

.github/workflows/check_links_config.json

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

0 commit comments

Comments
 (0)