Skip to content

ci/hostnames: Add PR check for example hostnames - #1933

Closed
marcleblanc2 wants to merge 7 commits into
mainfrom
marc/docs/check-example-hostnames
Closed

marcleblanc2 wants to merge 7 commits into
mainfrom
marc/docs/check-example-hostnames

Conversation

@marcleblanc2

Copy link
Copy Markdown
Contributor

Stacked on #1876 (base branch is docs/normalize-example-hostnames; GitHub will retarget to main when that merges). Do not merge before #1876.

What

Adds a GitHub Actions PR check, Example hostnames / Canonical example hostnames (.github/workflows/check-hostnames.yml), that runs on every pull request touching docs/** and fails when a page uses a non-canonical placeholder hostname. The job is checkout + setup-node (version from .tool-versions) + node dev/check-hostnames.mjs; the script has no dependencies so there is no install step. Also runnable locally via pnpm run check-hostnames. It is not wired into the Next build, so Vercel deploys are unaffected.

Flagged → suggested:

Pattern Use instead
your-sourcegraph-instance.com, my_sourcegraph.io, … sourcegraph.example.com
sourcegraph.yourcompany.com, sourcegraph.your-domain.com, sourcegraph.mycompany.com, … sourcegraph.example.com
sourcegraph.company.com, sourcegraph.acme.io, sourcegraph.test:3443, sourcegraph.corp sourcegraph.example.com
myinstance.sourcegraph.com, yourinstance.sourcegraph.com, example.sourcegraph.com sourcegraph.example.com
src.example.com, src.acme.com sourcegraph.example.com
my-gitlab.example.com (any my-*.example.com) gitlab.example.com
bitbucketserver.example.com, your-bbs-instance.example.com bitbucket.example.com
github-enterprise.example.com, ghe.example.com github.example.com
smtp-server.example.com smtp.example.com
any host under mycompany.*, yourcompany.*, company.*, corp.*, acme.*, mydomain.*, yourdomain.* — e.g. grafana.mycompany.com, psql1.mycompany.org, github.internal.company.net grafana.example.com, psql1.example.com, github.internal.example.com
mycompany.onelogin.com (any mycompany/acme/yourorg… tenant on a real SaaS domain) example.onelogin.com
any *.sgdev.org never in public docs

Skipped, matching #1876: auto-generated SCHEMA_SYNC blocks (fix upstream in sourcegraph/sourcegraph) and docs/technical-changelog.mdx.

Output on failure is docs/<file>:<line> plus found: / use: so the fix is copy-pasteable.

Also in this PR

Two leftover internal hosts the new check caught on top of #1876: gitlab.sgdev.org/sourcegraph/src-cli in batch-changes/tracking-existing-changesets.mdx and https://cse-k8s.sgdev.org/.api/graphql in cli/explanations/env.mdx.

Verification

  • Against main (pre-docs/hostnames: Normalize placeholder hostnames to *.example.com #1876): ❌ Found 127 non-canonical example hostname(s), exit 1.
  • Against this branch: ✅ All example hostnames are canonical!, exit 0.
  • actionlint passes on the workflow; the script runs green from a directory containing only docs/ and dev/ (no node_modules).
  • Injecting your-sourcegraph-instance.com and my-gitlab.example.com into a scratch .mdx fails the check with the expected suggestions.

Amp threads


Replaces #1878 (branch renamed to marc/docs/check-example-hostnames).

marcleblanc2 and others added 7 commits September 8, 2026 01:28
Standardize on sourcegraph.example.com for "your Sourcegraph instance"
(replacing your-sourcegraph-instance.com, sourcegraph.company.com,
sourcegraph.your*.com, *.sourcegraph.com placeholders, sourcegraph.test:3443,
src.acme.com, and URL-style angle-bracket placeholders), and on
<service>.example.com for code hosts and infra (my-*.example.com,
bitbucketserver/your-bbs-instance, github-enterprise, smtp-server,
*.company.net, bitbucket.sgdev.org).

Auto-generated SCHEMA_SYNC blocks and the technical changelog are left
untouched; the schema descriptions must be fixed upstream.

Co-authored-by: Amp <[email protected]>
Amp-Thread-ID: https://ampcode.com/threads/T-01a07e6a-e26f-753a-8486-cd5b81a79672
… *.example.com

Postgres, PgBouncer, Redis, Grafana, Prometheus, registry, and external
pgsql example hosts, plus the CAA dig example in the Cloud docs.

Amp-Thread-ID: https://ampcode.com/threads/T-01a07e6a-e26f-753a-8486-cd5b81a79672
Co-authored-by: Amp <[email protected]>
Adds dev/check-hostnames.mjs, run from next.config.js alongside the
existing link/filename/image checks, so a Vercel preview build (and thus
the PR check) fails when docs use a non-canonical placeholder host:

- your-sourcegraph-instance.com, sourcegraph.yourcompany.com,
  sourcegraph.company.com, myinstance.sourcegraph.com, src.example.com,
  etc. -> sourcegraph.example.com
- my-gitlab.example.com, bitbucketserver.example.com,
  github-enterprise.example.com, *.company.net -> <service>.example.com
- any *.sgdev.org (internal Sourcegraph infrastructure)

SCHEMA_SYNC blocks and technical-changelog.mdx are skipped, matching the
normalization PR. Also fixes the two remaining sgdev.org references the
check found.

Amp-Thread-ID: https://ampcode.com/threads/T-01a07e6a-e26f-753a-8486-cd5b81a79672
Co-authored-by: Amp <[email protected]>
…hostnames

Generalizes the company-domain rule from a fixed list of code hosts to
any host under a fictional company domain (mycompany, yourcompany,
company, corp, acme, mydomain, yourdomain), so infra placeholders like
grafana.mycompany.com and psql1.mycompany.org are caught too.

Amp-Thread-ID: https://ampcode.com/threads/T-01a07e6a-e26f-753a-8486-cd5b81a79672
Co-authored-by: Amp <[email protected]>
…t build

Adds .github/workflows/check-hostnames.yml (on pull_request touching
docs/**) and removes the next.config.js hook. The script no longer needs
the glob dependency, so the job is checkout + setup-node + node.

Amp-Thread-ID: https://ampcode.com/threads/T-01a07e6a-e26f-753a-8486-cd5b81a79672
Co-authored-by: Amp <[email protected]>
…stnames

Suggests example.<saas-domain> (e.g. example.onelogin.com).

Amp-Thread-ID: https://ampcode.com/threads/T-01a07e6a-e26f-753a-8486-cd5b81a79672
Co-authored-by: Amp <[email protected]>
@vercel

vercel Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sourcegraph-docs Error Error Sep 11, 2026 5:25pm UTC

Request Review

@marcleblanc2
marcleblanc2 force-pushed the marc/docs/normalize-example-hostnames branch 2 times, most recently from 6e05535 to 02f8d7b Compare October 1, 2026 07:11
Base automatically changed from marc/docs/normalize-example-hostnames to main October 1, 2026 07:11
@marcleblanc2

Copy link
Copy Markdown
Contributor Author

Superseded by #2039, which does the same check diff-aware and advisory, matching the links/redirects/spelling checks. The doc fixes here landed in #1932.

marcleblanc2 added a commit that referenced this pull request Oct 2, 2026
Mapping entries can be literal text, a glob where `*` matches a run of
hostname characters, or a `/regex/`. Matching ignores case, and `-`,
`_`, and `.` in literal and glob entries match any of the three, so one
entry covers the spelling variants the docs used. The JSON is 2-space
indented with keys and lists sorted, and the duplicated literals are
folded into glob and regex entries, including the patterns from #1933.

The workflow runs only when a PR touches docs/ or the check itself.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0fdce-6d4c-708e-a1ac-c5a8f9e48a65
Co-authored-by: Amp <[email protected]>

This branch had an error being deployed

1 failed deployment
Preview — 4c5f1fb8 Deployed Sep 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant