ci(ui): only run the UI build when dashboard files change - #32809
ci(ui): only run the UI build when dashboard files change#32809ryan-crabbe-berri wants to merge 1 commit into
Conversation
build-ui ran a full `next build` (~10 min, npm ci + build) on every PR, including backend-only ones. Mirror the frontend-lint job's pattern: keep the job always running so the required check never strands, but gate the install and build steps on whether anything under ui/litellm-dashboard actually changed. On backend-only PRs the job now reports success immediately without installing or building.
Greptile SummaryThis CI-only change optimises the
Confidence Score: 4/5Safe to merge — the change is purely additive to a CI workflow and cannot affect production code. The implementation correctly mirrors the existing frontend-lint job's change-detection pattern. The one edge case worth noting is that a git diff failure would silently fall through to ui_changed=false and skip the build rather than failing the step, but fetch-depth: 0 makes that scenario very unlikely in practice. No files require special attention beyond the single workflow file changed.
|
| Filename | Overview |
|---|---|
| .github/workflows/test-litellm-ui-build.yml | Adds a "Detect UI changes" step to the build-ui job to skip expensive npm ci + next build steps when no dashboard files changed; mirrors the existing frontend-lint job pattern with fetch-depth: 0 and a git diff guard. |
Reviews (1): Last reviewed commit: "ci(ui): only run the UI build when dashb..." | Re-trigger Greptile
| run: | | ||
| if git diff --name-only "$BASE_SHA"...HEAD -- . | grep -q .; then | ||
| echo "ui_changed=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "ui_changed=false" >> "$GITHUB_OUTPUT" | ||
| echo "No ui/litellm-dashboard changes in this PR; skipping build." | ||
| fi |
There was a problem hiding this comment.
Silent git failure sets ui_changed=false
GitHub Actions uses bash -eo pipefail by default, but if pipeline; then absorbs the pipeline's exit code rather than propagating it as a script error. If git diff were to fail (e.g., BASE_SHA not in the fetched history despite fetch-depth: 0), the pipeline exits non-zero, the else branch fires, and ui_changed=false is written — silently skipping the build even when dashboard files did change. fetch-depth: 0 makes this scenario unlikely, and the existing frontend-lint job uses the same pattern, so this is a minor robustness note rather than a blocking concern.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Folding this into #32810; the build-ui gating and the lint-workflow split touch the same file and are one concern, so they belong in a single PR. |
Relevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
The
build-uijob ran a fullnpm ci+npm run build(a ~10-minutenext build) on every PR, backend-only ones included, even though nothing it builds had changed. This gates it the same wayfrontend-lintalready gates itself: the job still runs on every PR so the required check reports a result and never strands, but the install and build steps only execute when a file underui/litellm-dashboard/actually changed.The detection step runs from the job's
working-directory(ui/litellm-dashboard), sogit diff --name-only "$BASE_SHA"...HEAD -- .is already scoped to the dashboard; it needsfetch-depth: 0on the checkout so the base commit is present for the diff.Behavior:
This is a CI-only change; the logic mirrors the existing
frontend-lintjob in the same repo, and both workflow files parse as valid YAML.Type
🚄 Infrastructure
Changes
Add a "Detect UI changes" step to
build-uiand gateSetup Node,Install dependencies, andBuildon itsui_changedoutput. Addfetch-depth: 0to the checkout so the PR base commit is available to diff against.The job intentionally still runs on every PR rather than using a workflow-level
paths:filter; apaths:filter would leave the required check pending forever on PRs that don't touch the UI, which is the stranding problem this repo already solved for backend tests in #32532. Keeping the job and gating its steps avoids that.