Commit ecf4db2
authored
fix: resolve 'Invalid path to URI' warnings in link checker (#1546)
## Description
This PR fixes the "Invalid path to URI" warnings that were appearing in
the link checker workflow, as seen in [run
#17112628120](https://github.com/wandb/docs/actions/runs/17112628120/job/48537193784#step:5:91).
## Problem
The link checker was encountering relative links like
`/guides/hosting/hosting-options/self-managed/` in the markdown files
but couldn't resolve them without a base URL. This caused many warnings
in the workflow output.
## Solution
1. **Added `--base-url` parameter** to lychee so it can properly resolve
relative paths
2. **Dynamic base URL detection**:
- For main branch: Uses production URL `https://docs.wandb.ai`
- For PR branches: Uses Cloudflare branch preview URL (e.g.,
`https://branch-name.docodile.pages.dev`)
3. **Proper branch name conversion** to match Cloudflare's format:
- 28 character limit
- Lowercase
- Special characters replaced with hyphens
- Leading/trailing hyphens removed
4. **Retry logic** for checking preview URL availability (new PRs may
take time to deploy)
5. **Clear reporting** of which base URL was used in the workflow
summary
## Benefits
- ✅ Eliminates "Invalid path to URI" warnings
- ✅ Checks links against the correct environment:
- PR branches check against their preview deployment
- Main branch checks against production
- ✅ Better visibility with base URL shown in workflow summary
- ✅ More accurate link checking for PRs (checks against PR's changes,
not production)
## Testing
The workflow now:
1. Detects if it's running on main or a PR branch
2. Constructs the appropriate Cloudflare preview URL for PRs
3. Tests if the preview is accessible (with retries)
4. Falls back to production URL if preview isn't ready
5. Uses the determined base URL for all link checking
This ensures relative links are properly resolved and checked against
the appropriate environment.1 parent 4c15e4b commit ecf4db2
1 file changed
Lines changed: 61 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
26 | 83 | | |
27 | 84 | | |
28 | 85 | | |
29 | 86 | | |
30 | 87 | | |
31 | | - | |
| 88 | + | |
32 | 89 | | |
33 | 90 | | |
34 | 91 | | |
| |||
132 | 189 | | |
133 | 190 | | |
134 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
135 | 195 | | |
136 | 196 | | |
137 | 197 | | |
| |||
0 commit comments