Skip to content

Commit b29aada

Browse files
HazATclaude
andcommitted
fix(lighthouse-ci): upload artifacts from the treosh action's resultsPath output
All 27 Lighthouse cells succeeded in CI run db8a4bb but NO PR comment was posted. The Lighthouse Report job logged: Only 0/27 Lighthouse cells have results (< 50%). Skipping comment. Root cause: the upload-artifact step had `path: .lighthouseci/` (in our repo root), but `lhci collect` writes to `.lighthouseci/` inside the treosh action's own working directory (`/home/runner/work/_actions/treosh/ lighthouse-ci-action/.../node_modules/lighthouse-ci/` or similar) \u2014 not our repo root. So the upload step found 0 files, and because of `if-no-files-found: ignore`, silently succeeded with no artifact uploaded. All 27 cells therefore reported "success" while uploading nothing. The treosh action exposes the actual path via its `resultsPath` output. Fix: - Add `id: lighthouse` to the action step. - Switch `path:` to `${{ steps.lighthouse.outputs.resultsPath }}`. - Gate the upload on `resultsPath` being set so a failed Lighthouse run doesn't try to upload nothing. - Switch `if-no-files-found` from `ignore` to `error` so a missing or empty dir is now a loud bug instead of a silent zero-upload. Co-Authored-By: Claude claude-opus-4-5 <noreply@anthropic.com>
1 parent db8a4bb commit b29aada

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,7 @@ jobs:
13071307
REACT_APP_SENTRY_LIGHTHOUSE_MODE: ${{ matrix.mode }}
13081308

13091309
- name: Run Lighthouse CI
1310+
id: lighthouse
13101311
# Pinned to a commit SHA (rather than the floating @v12 tag) to lock down the
13111312
# supply chain: this third-party action also npm-installs @lhci/cli, so an
13121313
# upstream tag-repoint could otherwise change what runs on our runners.
@@ -1329,13 +1330,20 @@ jobs:
13291330
LIGHTHOUSE_URL: 'http://localhost:3000/'
13301331

13311332
- name: Upload Lighthouse results
1333+
# `resultsPath` points at the .lighthouseci/ directory inside the treosh action's
1334+
# own working directory (NOT our repo root — lhci's cwd when the action invokes it
1335+
# is the action's checkout). Use it explicitly so upload-artifact finds the real
1336+
# files. Without this, `path: .lighthouseci/` silently finds nothing in our repo
1337+
# root and `if-no-files-found: ignore` makes the step pass with zero uploaded.
13321338
uses: actions/upload-artifact@v7
1333-
if: always()
1339+
if: always() && steps.lighthouse.outputs.resultsPath != ''
13341340
with:
13351341
name: lighthouse-${{ matrix.app }}-${{ matrix.mode }}
1336-
path: .lighthouseci/
1342+
path: ${{ steps.lighthouse.outputs.resultsPath }}
13371343
retention-days: 7
1338-
if-no-files-found: ignore
1344+
# Fail loudly if the dir is empty — we already gated on resultsPath being set,
1345+
# so an empty dir means lhci collect produced nothing, which is a real bug.
1346+
if-no-files-found: error
13391347

13401348
job_lighthouse_report:
13411349
name: Lighthouse Report

0 commit comments

Comments
 (0)