Skip to content

Commit 97590b2

Browse files
authored
ci: fast docs format check for docs-only PRs (#2028)
Since #1991, docs-only PRs skip the full CI matrix, so nothing format-checks markdown (`vp check` in cli-e2e-test only runs for code changes). As suggested in [this comment](#1991 (comment)), add a fast `docs-fmt` job that runs `vp fmt --check` when `code-changed == 'false'`. How it stays fast (about 15s total on the runner, the check itself is about 5s for 1,879 files): - `setup-vp` installs the released Vite+ (`version: latest`, since the workspace `vite-plus` version can be ahead of the registry) with `run-install: false`. - `vp fmt` needs the root `vite.config.ts` to load, and its runtime `import ... from 'vite-plus'` must resolve. Instead of installing the whole workspace (which also needs the vite/rolldown subrepo clones), the job symlinks the released `vite-plus` package out of the global install into `node_modules/`. - Checks the whole repo, so root markdown (README, RFCs) is covered too, matching the `**/*.md` part of the CI skip filter. Non-blocking as suggested: the job is not listed in the `done` job's needs. Verified on this PR by temporarily lifting the skip condition (middle commits, since ci.yml itself is a code change the job would otherwise skip here): - [Failing run](https://github.com/voidzero-dev/vite-plus/actions/runs/28635962494/job/84922274235) on an intentionally misformatted canary file - [Passing run](https://github.com/voidzero-dev/vite-plus/actions/runs/28636039893/job/84922566220) after removing it The final commit restores the `code-changed == 'false'` guard, so the job is expected to be skipped on this PR itself.
1 parent 0af68ff commit 97590b2

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,33 @@ jobs:
5959
- '!.github/workflows/deploy-docs.yml'
6060
- '!netlify.toml'
6161
62+
docs-fmt:
63+
name: Docs format check
64+
needs: detect-changes
65+
# Docs-only changes skip the full CI matrix, so nothing else format-checks
66+
# them (code changes get `vp check` in cli-e2e-test). Non-blocking:
67+
# intentionally not listed in the `done` job's needs.
68+
if: needs.detect-changes.outputs.code-changed == 'false'
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
72+
73+
- uses: voidzero-dev/setup-vp@35171c92dd08b67d5a9d3f2a4327800e58396f2a # v1.13.0
74+
with:
75+
# The workspace `vite-plus` version can be ahead of the registry, so
76+
# pin the released build instead of auto-detecting from package.json.
77+
version: latest
78+
run-install: false
79+
80+
- name: Run vp fmt --check
81+
run: |
82+
# `vp fmt` loads the root vite.config.ts, whose `import ... from 'vite-plus'`
83+
# must resolve at runtime. Link the released package out of the global
84+
# install instead of installing the whole workspace.
85+
mkdir -p node_modules
86+
ln -s "$HOME/.vite-plus/current/node_modules/vite-plus" node_modules/vite-plus
87+
vp fmt --check
88+
6289
download-previous-rolldown-binaries:
6390
needs: detect-changes
6491
if: needs.detect-changes.outputs.code-changed == 'true'

0 commit comments

Comments
 (0)