Skip to content

ci: Fail PRs that add an underscore to a docs/ file or folder name - #2063

Closed
marcleblanc2 wants to merge 1 commit into
mainfrom
marc/ci/check-filenames
Closed

marcleblanc2 wants to merge 1 commit into
mainfrom
marc/ci/check-filenames

Conversation

@marcleblanc2

Copy link
Copy Markdown
Contributor

What

A new PR check, Check filenames, that fails when a file or folder name under docs/ contains an underscore. It runs the same dev/check-filenames.mjs that pnpm run build already runs, so the PR check and the Vercel build agree on what's a bad name, and the offending paths get a ::error annotation on the Files changed tab.

Why

pnpm run build already fails on an underscore under docs/, but only Vercel team members can read that log. Underscores in docs/ paths become underscores in URLs, which we're cleaning up in #2059 and #2061; this stops new ones landing.

Changes

  • .github/workflows/check-filenames.yml: checks out the PR head and runs the script. No install step
  • dev/check-filenames.mjs: replace the glob import with fs.readdirSync(…, {recursive: true}) so the workflow needs no dependencies; report an underscored folder once rather than every file under it; print ::error file=… annotations under GitHub Actions
  • AGENTS.md: mention the PR check

Test plan

  • Script passes on main (zero underscores under docs/)
  • Locally, with docs/zz_test/, docs/admin/bad_name.md and docs/admin/bad_image.png added: all three reported, exit 1, annotations printed when GITHUB_ACTIONS=true
  • Workflow runs green on this PR
  • Once merged, add Underscores in docs/ file and folder names to the required checks on main

dev/check-filenames.mjs already fails the Vercel build on an underscore under
docs/, but only Vercel team members can read that log. Run the same script as
a GitHub PR check, and annotate the offending paths on the Files changed tab.

Replace the script's glob import with fs.readdirSync(recursive) so the
workflow needs no install step, and report an underscored folder once rather
than every file under it.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0fe12-a1a1-7090-a749-5db8a1a35dc0
Co-authored-by: Amp <amp@ampcode.com>
@marcleblanc2
marcleblanc2 requested a review from enriquegh October 2, 2026 19:28
@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
sourcegraph-docs Ready Ready Preview Oct 2, 2026 7:29pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

@marcleblanc2

Copy link
Copy Markdown
Contributor Author

Closing: dev/check-filenames.mjs already fails the Vercel build on an underscore in a docs/ file or folder name, so this check would only duplicate it on the GitHub side.

@marcleblanc2
marcleblanc2 deleted the marc/ci/check-filenames branch October 2, 2026 19:49

This branch was successfully deployed

1 active deployment
Preview — ff6881d9 Deployed Oct 2, 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