Skip to content

Run Lighthouse only where it measures something new - #7

Merged
carstenb merged 1 commit into
masterfrom
ci-lighthouse-scope
Oct 13, 2026
Merged

carstenb merged 1 commit into
masterfrom
ci-lighthouse-scope

Conversation

@carstenb

Copy link
Copy Markdown
Owner

Lighthouse is the slowest CI step (about 1.5 of 2.5 minutes). This limits it to runs where it can find something new. All other checks run unchanged.

When Lighthouse runs

  • Pull request: only if at least one changed file could end up on the site. It is skipped when every change is under profile/, .claude/, README.md, .gitignore, .gitattributes or .github/workflows/sync-profile-readme.yml. Unknown paths count as relevant, so a new file type never slips past by accident.
  • Push to master: skipped. Branch protection on master requires a pull request that is up to date (strict: true, enforced for admins too), so the merge commit is exactly what that pull request already measured. The deploy job still waits for validate.
  • Manual run (workflow_dispatch): always measures.

How

  • Checkout uses fetch-depth: 2, so the PR merge commit has its base as first parent; git diff --name-only HEAD^1 HEAD lists the PR's changes.
  • A new step "Decide whether Lighthouse runs" prints the changed files and its decision, and the Lighthouse step has an if: on that output.

Checks

  • Filter logic tested under bash with sample change sets (profile-only → skip, profile + index.html → run, CSS → run, sync workflow + .claude → skip).
  • Workflow YAML parses; step order unchanged apart from the new step.
  • This PR changes validate.yml, so Lighthouse should run on it, which exercises the "run" path in CI. The "skip" path shows on the next profile-only PR.

🤖 Generated with Claude Code

Skipped on pushes to master: branch protection requires an up-to-date
pull request, so the merge commit is what that pull request measured.
Skipped on pull requests that only touch files the deployed site does
not contain (profile/, .claude/, README.md, git config, the profile
sync workflow). Unknown paths count as relevant, manual runs always
measure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@carstenb
carstenb merged commit bb44160 into master Oct 13, 2026
2 checks passed
@carstenb
carstenb deleted the ci-lighthouse-scope branch October 13, 2026 20:47
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.

1 participant