Skip to content

Commit 22d860c

Browse files
Use sed pre-processing instead of --remap for root-relative links
Replace the lychee --remap flag with a sed pre-processing step (matching the approach used in MSAL Java) that rewrites root-relative markdown links like [text](/path) to [text](https://learn.microsoft.com/path) before lychee runs. The --remap regex approach couldn't intercept root-relative links before lychee's own root-relative resolver rejected them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 857a404 commit 22d860c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/linkvalidator.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v3
1818

19+
- name: Resolve root-relative links for checking
20+
run: |
21+
# Convert root-relative markdown links like [text](/path) to [text](https://learn.microsoft.com/path)
22+
# so lychee can validate them. This only modifies the CI checkout copy.
23+
find . -name '*.md' -exec sed -i -E 's|\]\(/|\](https://learn.microsoft.com/|g' {} +
24+
1925
- name: Link Checker
2026
id: lychee
2127
uses: lycheeverse/lychee-action@master
2228
env:
2329
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
2430
with:
25-
args: --accept=200,429,403,502,503 --verbose --no-progress --remap '^/(.+) https://learn.microsoft.com/$1' './**/*.md'
31+
args: --accept=200,429,403,502,503 --verbose --no-progress './**/*.md'
2632
fail: true
2733

2834
- name: Create Issue From File

0 commit comments

Comments
 (0)