ci: skip Go jobs and add docs-site build for docs-only PRs#21028
ci: skip Go jobs and add docs-site build for docs-only PRs#21028
Conversation
Add a `changes` job that detects whether any non-docs files changed. Go CI jobs (tests, race-tests, lint, bench, kurtosis, repro, sonar, caplin, hive) are skipped when every changed file is under docs/, saving ~30 min of unnecessary CI for docs-only PRs. Add `docs-site` job (npm ci → typecheck → docusaurus build) that runs whenever docs/site/** is touched. Docusaurus is configured with onBrokenLinks/onBrokenMarkdownLinks/onBrokenAnchors all set to 'throw', so the build catches internal broken links at PR time. For merge_group and workflow_dispatch the full suite always runs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the CI gate workflow to detect docs-only pull requests and skip expensive Go CI jobs when only docs/** files changed, while adding a dedicated docs-site build (typecheck + Docusaurus build) when docs/site/** is touched.
Changes:
- Add a
changesjob to classify PRs as “code changed” vs “docs-only”, and conditionally skip Go CI jobs for docs-only PRs. - Add a reusable
docs-site-build.ymlworkflow and adocs-sitejob inci-gateto runnpm ci→typecheck→buildwhendocs/site/**changes. - Wire
changesoutputs into jobif:conditions and includechanges/docs-sitein theci-gateaggregation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/docs-site-build.yml | Adds a reusable workflow to typecheck and build the Docusaurus docs site. |
| .github/workflows/ci-gate.yml | Adds PR-change detection and uses it to skip Go CI for docs-only PRs; triggers docs-site build when needed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add pull-requests:read permission so the gh api call in the changes job can fetch PR file lists without a 403 - Remove the pull_request guard on lint so it also runs in merge_group Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
llms.txt and llms-full.txt live at the repo root and are regenerated by the Docusaurus build (docs/site/scripts/generate-llms.py). Without this, PRs that update those files would trigger the full Go CI suite despite being pure docs changes. Also extends the pattern to root-level *.md files (README.md, CLAUDE.md, etc.) for the same reason. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
docs/site/ does not exist on main until PR #21013 merges. Without a guard, the docs-site job fires for merge_group events (docs_site=true for all non-PR events) and fails on npm ci in a missing directory, blocking this PR from merging itself. Add a presence check on docs/site/package.json; steps are skipped (job passes) when the directory is absent. Also: - node-version '20' -> '20.x' (standard semver range notation) - drop secrets:inherit from docs-site job (build needs no secrets) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Additional fix pushed (llms.txt coverage): After reviewing #21000, noticed that Extended the This excludes from the "code changed" check:
Nested |
- Fail explicitly if gh api call returns an error instead of silently continuing with empty $files (which would default to code=true) - Add comment explaining the file-pattern regex for future maintainers
When a PR touches docs/site/**, also verify: - generate-llms.py --check (regenerated outputs match committed files) - unittest discover (25-test suite stays green) Mirrors the guard in #21000's docs-deploy.yml so PRs to main get the same llms.txt drift protection that release/3.4 gets at deploy time.
## Summary Sibling of #21028 (which lands the same path-filter on `main`'s `ci-gate.yml`). When a PR only touches `docs/`, root `llms*.txt`, or root `*.md`, skip the `linux` and `win` Go test runs (~20-30 min saved per PR) and instead run a docs-site typecheck/build with the llms.txt drift + unittest guard. ### How it works A new fast `changes` job calls `gh api .../pulls/{n}/files` and emits two outputs: - `code` — `false` if every changed file is under `docs/`, root `llms*.txt`, or root `*.md`; otherwise `true`. Defaults to `true` for `push` / `workflow_dispatch` so nothing is skipped on merge. - `docs_site` — `true` when any `docs/site/**` file is touched. `linux` and `win` are gated on `code != 'false'`. A new `docs-site` job (calling the new reusable `docs-site-build.yml`) runs when `docs_site == 'true'`. If the `gh api` call fails, the step exits with code 1 — the gate fails rather than silently defaulting to skipping jobs. ### What runs when | PR scope | linux/win | docs-site | |----------|-----------|-----------| | Pure code (`*.go`, etc.) | ✅ runs | ⏭️ skipped | | Mixed code + docs | ✅ runs | ✅ runs | | Pure docs (`docs/site/**`) | ⏭️ skipped | ✅ runs | | Pure root-level docs (`llms.txt`, `README.md`) | ⏭️ skipped | ⏭️ skipped | | `push` to `main` / `release/**` | ✅ runs | ✅ runs | ### File-pattern logic A PR is **docs-only** (skips Go CI) when every changed file matches: ``` ^(docs/|llms[^/]*\.txt$|[^/]*\.md$) ``` i.e. files under `docs/`, root-level `llms*.txt`, or root-level `*.md`. Nested `.md` files (e.g. `execution/README.md`) still count as code changes. ### `docs-site-build.yml` Reusable `workflow_call` leaf that: 1. Sets up Python 3.11 + runs `python3 docs/site/scripts/generate-llms.py --check` and `python3 -m unittest discover docs/site/scripts -v` (the llms drift guard from #21000) 2. Sets up Node 20 + runs `npm ci`, `npm run typecheck`, `npm run build` against `docs/site/` Has a defensive guard that skips silently if `docs/site/package.json` **or** `docs/site/scripts/generate-llms.py` is absent — covering both fully absent `docs/site/` and partial migration states. ### Files | File | Change | |------|--------| | `.github/workflows/ci.yml` | Add `permissions: pull-requests: read`, `changes` job, gate `linux`/`win` with `code != 'false'`, add `docs-site` job | | `.github/workflows/docs-site-build.yml` | New reusable workflow (Python llms guard + Node typecheck/build) | ## Test plan - [ ] Open a docs-only PR (touch `docs/site/docs/...`) — confirm `linux`/`win` are skipped and `docs-site` runs - [ ] Open a mixed PR (one `.go` file + one `.md` file) — confirm both `linux`/`win` and `docs-site` run - [ ] Open a pure code PR — confirm `docs-site` is skipped, `linux`/`win` run - [ ] Push to `release/3.4` — confirm everything runs (no skipping) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Bloxster <bloxster@proton.me> Co-authored-by: Gianni <gianni@erigon.dev> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Summary
changesjob that queries the GitHub API to detect whether any non-docs/files changed in the PRdocs/, saving ~30 min of unnecessary CI for docs-only PRsdocs-sitejob (npm ci→typecheck→docusaurus build) that runs wheneverdocs/site/**is touched —onBrokenLinks/onBrokenMarkdownLinks/onBrokenAnchorsare all set tothrowin the Docusaurus config, so the build catches internal broken links at PR timemerge_groupandworkflow_dispatchthe full suite always runschangesis included inci-gateneeds — if thegh apicall fails the step explicitly errors (exit 1), so the gate fails rather than silently defaulting to skipping jobsmerge_group), not justpull_requestCI matrix after this merges
large-filesdocs-sitedocs/site/**onlydocs/site/**+ codeFile-pattern logic
A PR is considered docs-only (skips Go CI) when every changed file matches:
i.e. files under
docs/, root-levelllms*.txt, or root-level*.md. Nested.mdfiles (e.g.execution/README.md) still count as code changes.Test plan
.github/workflows/) → full Go CI runs, validating the new logicchangesjob outputscode=truefor this PRdocs-siteruns🤖 Generated with Claude Code