Skip to content

Commit b98aa3b

Browse files
committed
Add hint about redirects caused by trailing slashes on the Mintlify SaaS
1 parent a27c5e5 commit b98aa3b

1 file changed

Lines changed: 31 additions & 2 deletions

File tree

.github/workflows/linkcheck-pr.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ jobs:
9292
if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch'
9393
uses: lycheeverse/lychee-action@v2
9494
with:
95-
# Configuration is in lychee.toml
96-
# Don't fail the workflow on broken links (informational only)
95+
args: "--threads 5 --max-retries 5 --retry-wait-time 2 --exclude '/ja' --exclude '/ko' --include '^https?://' --include '^http?://' --base-url='${{ github.event.deployment_status.environment_url }}' '.'"
96+
format: markdown
9797
fail: false
9898
# Don't fail if no files to check
9999
failIfEmpty: false
@@ -128,6 +128,22 @@ jobs:
128128
if (isFork && !deployUrl) {
129129
commentBody += '\n_Note: Checked against production site (https://docs.wandb.ai) since preview deployments are not available for forks._\n';
130130
}
131+
132+
// Check if there were redirects in the report
133+
try {
134+
const report = fs.readFileSync('./lychee/out.md', 'utf8');
135+
if (report.includes('Redirect') || report.includes('redirect')) {
136+
commentBody += '\n\n> [!TIP]\n';
137+
commentBody += '> **Redirects detected**: If you see redirects for internal docs.wandb.ai links, check if they have trailing slashes.\n';
138+
commentBody += '> \n';
139+
commentBody += '> Mintlify automatically removes trailing slashes, causing redirects like:\n';
140+
commentBody += '> - `https://docs.wandb.ai/models/` → `https://docs.wandb.ai/models`\n';
141+
commentBody += '> \n';
142+
commentBody += '> **Fix**: Remove trailing slashes from links to avoid unnecessary redirects.\n';
143+
}
144+
} catch (e) {
145+
// Ignore if report file doesn't exist
146+
}
131147
} else {
132148
// Issues found - include report
133149
const report = fs.readFileSync('./lychee/out.md', 'utf8');
@@ -143,6 +159,19 @@ jobs:
143159
}
144160
commentBody += '> \n';
145161
commentBody += '> Warnings about **new** files in this PR can be safely ignored.\n\n';
162+
163+
// Add trailing slash tip if redirects are present
164+
if (report.includes('Redirect') || report.includes('redirect')) {
165+
commentBody += '> [!TIP]\n';
166+
commentBody += '> **Redirects detected**: If you see redirects for internal docs.wandb.ai links, check if they have trailing slashes.\n';
167+
commentBody += '> \n';
168+
commentBody += '> Mintlify automatically removes trailing slashes, causing redirects like:\n';
169+
commentBody += '> - `https://docs.wandb.ai/models/` → `https://docs.wandb.ai/models`\n';
170+
commentBody += '> - `/weave/quickstart/` → `/weave/quickstart`\n';
171+
commentBody += '> \n';
172+
commentBody += '> **Fix**: Remove trailing slashes from links to avoid unnecessary redirects.\n\n';
173+
}
174+
146175
commentBody += '---\n\n';
147176
commentBody += report;
148177
}

0 commit comments

Comments
 (0)