Skip to content

ci: skip Go jobs and add docs-site build for docs-only PRs#21028

Open
bloxster wants to merge 12 commits intomainfrom
ci/docs-path-filter
Open

ci: skip Go jobs and add docs-site build for docs-only PRs#21028
bloxster wants to merge 12 commits intomainfrom
ci/docs-path-filter

Conversation

@bloxster
Copy link
Copy Markdown
Collaborator

@bloxster bloxster commented May 7, 2026

Summary

  • Add a changes job that queries the GitHub API to detect whether any non-docs/ files changed in the PR
  • 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 a docs-site job (npm citypecheckdocusaurus build) that runs whenever docs/site/** is touched — onBrokenLinks/onBrokenMarkdownLinks/onBrokenAnchors are all set to throw in the Docusaurus config, so the build catches internal broken links at PR time
  • For merge_group and workflow_dispatch the full suite always runs
  • changes is included in ci-gate needs — if the gh api call fails the step explicitly errors (exit 1), so the gate fails rather than silently defaulting to skipping jobs
  • lint runs for all event types (including merge_group), not just pull_request

CI matrix after this merges

PR type large-files docs-site Go CI
docs/site/** only ✓ build + typecheck skipped
docs/site/** + code ✓ full suite
code only skipped ✓ full suite
merge_group ✓ full suite

File-pattern logic

A PR is considered 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.

Test plan

  • This PR itself is not docs-only (changes .github/workflows/) → full Go CI runs, validating the new logic
  • Verify changes job outputs code=true for this PR
  • After merge, open a docs-only PR and confirm Go jobs are skipped and docs-site runs

🤖 Generated with Claude Code

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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 changes job 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.yml workflow and a docs-site job in ci-gate to run npm citypecheckbuild when docs/site/** changes.
  • Wire changes outputs into job if: conditions and include changes/docs-site in the ci-gate aggregation.

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.

Comment thread .github/workflows/ci-gate.yml
Comment thread .github/workflows/ci-gate.yml
Bloxster and others added 3 commits May 7, 2026 09:48
- 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>
@bloxster
Copy link
Copy Markdown
Collaborator Author

bloxster commented May 7, 2026

Additional fix pushed (llms.txt coverage):

After reviewing #21000, noticed that llms.txt and llms-full.txt live at the repo root (not under docs/), and are regenerated by the Docusaurus build script on every docs update. Without a fix, any PR touching those files would have triggered the full Go CI suite despite being a pure docs change.

Extended the changes job filter pattern from '^docs/' to:
```
'^(docs/|llms[^/].txt$|[^/].md$)'
```

This excludes from the "code changed" check:

  • llms[^/]*\.txt$ — root-level llms.txt, llms-full.txt (and any future variants)
  • [^/]*\.md$ — root-level *.md files (README.md, CLAUDE.md, etc.)

Nested .md files inside Go packages (e.g. execution/README.md) are still treated as code changes — intentional.

bloxster and others added 5 commits May 7, 2026 10:44
- 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.
AskAlexSharov pushed a commit that referenced this pull request May 9, 2026
## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants