Skip to content

Make Lighthouse skippable, honest about failures, and easy to read - #12

Merged
gpmayorga merged 3 commits into
mainfrom
claude/github-actions-lib-centralize-rxomdp
Aug 18, 2026
Merged

Make Lighthouse skippable, honest about failures, and easy to read#12
gpmayorga merged 3 commits into
mainfrom
claude/github-actions-lib-centralize-rxomdp

Conversation

@gpmayorga

@gpmayorga gpmayorga commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Three changes to the performance-score job and its surrounding diagnostics. None of them alter what Lighthouse measures.

1. Skip instead of failing when there is no preview URL

build-deploy / performance-score failed on apps-management PRs with:

ERROR: Unable to automatically determine the location of static site files.
Error: Failed to automatically determine `staticDistDir`

Misleading — nothing about static dirs was wrong. actions/deploy-app yields an empty deployment-url when Cloudflare returns no preview URL, warns, and lets the deploy succeed (correct). The Lighthouse job then ran lhci autorun --collect.url="", and with no URL LHCI assumes you're testing a static build and goes hunting for a dist directory.

The shared lighthouserc.json sets every assertion to off — reports are informational and by design cannot fail a build. Hard-failing because a preview URL is unavailable contradicts that, so the job now bails out early with a ::warning:: (and skips the pointless npm install -g @lhci/cli).

2. Stop the missing-preview-URL warning from blaming the wrong cause

deploy-app's warning asserted "Preview URLs disabled for <env>". That sent a real investigation down the wrong path for hours: launchpad-demo had previews enabled (a run the previous day printed https://3a40f0b1-launchpad-demo.kf-dev.workers.dev), and the URL only vanished after the Cloudflare API token was rotated — so the token looked guilty too. It wasn't either: the actual cause was wrangler deploy applying preview_urls = false, because declaring routes flips the workers_dev default (fixed app-side in centrifuge/apps-invest#313 and centrifuge/apps-management#1233).

wrangler resolves the preview URL with a follow-up API call after printing the Worker Version ID and stays silent when that call fails, so an absent URL is genuinely ambiguous. The warning now lists all three candidate causes in likelihood order instead of asserting one, and warns separately when cloudflare-account-id arrives empty — it's a required input, and apps-management was passing nothing (that empty value also produced a broken dash.cloudflare.com//workers-and-pages link in the old message).

3. Put the report link on the run summary

The hosted report was only reachable by expanding the job log and spotting lhci's Open the report at <url> line. It's now written to GITHUB_STEP_SUMMARY along with the tested URL, so it appears on the run's summary page.

Reports are deliberately not uploaded as artifacts — the shared config already publishes to LHCI temporary public storage, and these are throwaway testnet previews nobody is expected to revisit. The summary says the link expires after a few days rather than implying durable access.

Implementation notes: lhci output is teed so the URL can be lifted out, with set -o pipefail so a genuine lhci failure isn't masked by tee's exit status; if no hosted link is present (a caller overriding the upload target) the summary states that instead of rendering a broken link.

Verification

  • yamllint (relaxed, line-length off — matches lib-ci) clean on both changed files.
  • Extracted the step's shell and exercised it against the real log line from apps-invest's last successful run: link correctly extracted and rendered, fallback branch taken when the line is absent, and pipefail confirmed to propagate a non-zero lhci exit through tee.
  • Skip path checked both ways (empty → warn + exit 0; non-empty → runs against the URL).

Related

  • centrifuge/apps-invest#313 / centrifuge/apps-management#1233 — the actual root-cause fix (preview_urls = true in wrangler.toml). This PR is the safety net and the diagnostics.

🤖 Generated with Claude Code

claude added 3 commits August 18, 2026 13:32
deploy-app yields an empty deployment-url when Cloudflare returns no
preview URL (Preview URLs disabled for the Worker); it warns and carries
on. The Lighthouse job then ran `lhci autorun --collect.url=""`, which
makes LHCI fall back to hunting for a static dist dir and fail with a
misleading "Unable to automatically determine the location of static
site files" error — observed on apps-management#1151.

The shared lighthouserc.json sets every assertion to `off` (reports are
informational), so a missing preview URL must never fail a PR. Skip with
a clear warning instead, and stop the deploy-app warning from printing a
broken `dash.cloudflare.com//workers-and-pages` link when the account-id
input is empty.
The warning asserted "Preview URLs disabled for <env>", which sent an
investigation down the wrong path: apps-management's launchpad-demo has
Preview URLs enabled (a run from the previous day printed a real
https://<version>-launchpad-demo.kf-dev.workers.dev), yet the URL went
missing after its Cloudflare API token was rotated.

wrangler resolves the preview URL with a follow-up API call after
printing the Worker Version ID and stays silent when that call fails, so
an absent URL can equally mean the token cannot read the account's
workers.dev subdomain, or that no account id was supplied for wrangler
to resolve one. Name all three causes in likelihood order, and warn
separately when cloudflare-account-id arrives empty — it is a required
input, and apps-management is currently passing nothing.
The hosted report URL was only discoverable by expanding the job log and
finding lhci's "Open the report at <url>" line. Lift it into
GITHUB_STEP_SUMMARY alongside the tested URL, so it shows on the run's
summary page.

Reports are deliberately not uploaded as artifacts — the shared config
already publishes to LHCI temporary public storage and nobody is expected
to trawl old reports, so the summary notes that the link expires after a
few days rather than promising durable access.

lhci output is teed to lift the URL out; `set -o pipefail` keeps a real
lhci failure from being masked by tee's exit status. If no hosted link is
present (e.g. a caller overrides the upload target), the summary says so
instead of rendering a broken link.
@gpmayorga gpmayorga changed the title Skip Lighthouse when no preview URL is available Make Lighthouse skippable, honest about failures, and easy to read Aug 18, 2026
@gpmayorga
gpmayorga marked this pull request as ready for review August 18, 2026 14:19
@gpmayorga
gpmayorga requested a review from hieronx as a code owner August 18, 2026 14:19
@gpmayorga
gpmayorga merged commit bbd5177 into main Aug 18, 2026
3 checks passed
@gpmayorga
gpmayorga deleted the claude/github-actions-lib-centralize-rxomdp branch August 18, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants