Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
- **Build**: `npm run build`
- **Dev**: `npm run dev`
- **Lint**: `npm run lint`
- **Checks**: `npm run check` runs every `dev/check-*.mjs` (links, filenames, images); `npm run build` runs them first, so any finding fails a deploy
- **Check links**: `npm run check -- links --check-anchors --check-self-links` (CI comments on PRs that break links; see `dev/check-links.mjs`; the build runs it without flags, so only dead page links fail a deploy). When moving a page or renaming a heading, update every link to it; a redirect in `src/data/redirects.ts` does not satisfy the check. Link to this site with relative paths (`/admin/config/site-config`), never `https://sourcegraph.com/docs/…` or `https://docs.sourcegraph.com/…`. To also probe the external links you added: `npm run check -- links --check-anchors --check-self-links --check-external --diff <(git diff -U0 origin/main)`
- **Checks**: `npm run check` runs every `dev/check-*.mjs` (links, filenames, images); `npm run build` runs filenames and images first, so a finding from those fails a deploy. Links is not in the build: it runs as its own PR check (`.github/workflows/check-links.yml`)
- **Check links**: `npm run check -- links --check-anchors --check-self-links` (CI comments on PRs that break links and fails the `Broken links introduced by this PR` check; see `dev/check-links.mjs`). When moving a page or renaming a heading, update every link to it; a redirect in `src/data/redirects.ts` does not satisfy the check. Link to this site with relative paths (`/admin/config/site-config`), never `https://sourcegraph.com/docs/…` or `https://docs.sourcegraph.com/…`. To also probe the external links you added: `npm run check -- links --check-anchors --check-self-links --check-external --diff <(git diff -U0 origin/main)`
- **Prove changed links resolve on a deploy**: `node dev/verify-links-live.mjs --site <vercel-preview-url>` prints a Markdown table for the PR description
- **Vercel build failures**: Vercel shows build logs only to its team members, so `.github/workflows/vercel-build-report.yml` comments the log tail on the PR (see `dev/report-vercel-build.mjs`). It reads Vercel with the `VERCEL_TOKEN` repo secret, a token scoped to the `sourcegraph-docs` project that expires 2026-12-10; mint a new one with `POST /v3/user/tokens?teamId=<team>` and `projectId` in the body. It also attaches the full log to the Vercel Slack app's "failed to deploy" post in `#alerts-vercel-doc-site`, using the `SLACK_BOT_TOKEN` repo secret and `SLACK_CHANNEL_ID` repo variable. The bot is the Slack app in `dev/slack-app-vercel-build-report.json`; to recreate it, paste that manifest at <https://api.slack.com/apps?new_app=1> (From a manifest), install it, copy its Bot User OAuth Token into the secret, and `/invite @Vercel build log` to the channel

Expand Down
4 changes: 2 additions & 2 deletions dev/check-links.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* should be relative links; the finding proposes one, following src/data/redirects.ts
* - With --check-external, external links on added lines that return 404 or 410
*
* next.config.js runs this with no flags on every build, so only dead page links
* can fail a deploy; the flags below are for the pull request workflow.
* The pull request workflow (.github/workflows/check-links.yml) runs this with
* the flags below; `npm run build` does not run it, so findings never fail a deploy.
*
* Usage: node dev/check-links.mjs [options]
* --check-anchors Also validate #anchors against headings
Expand Down
5 changes: 3 additions & 2 deletions dev/checks.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env node

/**
* Runs the docs checks in dev/check-*.mjs. `npm run build` runs them all
* before `next build`.
* Runs the docs checks in dev/check-*.mjs. `npm run build` runs filenames and
* images before `next build`; links has its own pull request check
* (.github/workflows/check-links.yml), so a dead link does not fail a deploy.
*
* Usage: node dev/checks.mjs [check ...] [flags]
* node dev/checks.mjs every check
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"scripts": {
"dev": "next dev",
"build": "node dev/checks.mjs && node dev/generate-mermaid-icons.mjs && next build",
"build": "node dev/checks.mjs filenames images && node dev/generate-mermaid-icons.mjs && next build",
"start": "next start",
"lint": "next lint",
"check": "node dev/checks.mjs",
Expand Down
Loading