Extract run-lighthouse-ci into a separate reusable workflow#4807
Conversation
Summary by CodeRabbit
WalkthroughRefactors CI by extracting inline Lighthouse CI steps into a reusable workflow ( ChangesLighthouse CI Workflow Refactoring
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly Related PRs
Suggested Labels
Suggested Reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/run-lighthouse-ci.yaml:
- Around line 23-24: The checkout step using
actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd should disable
persisting the GITHUB_TOKEN to .git/config; update the checkout step (the step
with "uses: actions/checkout@...") to include the input persist-credentials:
false so credentials are not written into the workspace during the Lighthouse
job.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 285200f1-4a1a-4d37-9a66-73ae181453cf
📒 Files selected for processing (2)
.github/workflows/run-ci-cd.yaml.github/workflows/run-lighthouse-ci.yaml
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feature/ci-cd-optimization #4807 +/- ##
===========================================================
Coverage 98.77% 98.77%
===========================================================
Files 538 538
Lines 16987 16987
Branches 2406 2406
===========================================================
Hits 16779 16779
Misses 119 119
Partials 89 89
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
There was a problem hiding this comment.
2 issues found across 2 files
Confidence score: 3/5
- There is a concrete regression risk in
.github/workflows/run-lighthouse-ci.yaml:timeout-minutes: 5is likely insufficient for auditing 8 URLs, which can cause Lighthouse CI jobs to fail or time out intermittently. - Because the top issue is high severity/high confidence (8/10, 8/10) and directly affects CI reliability, this lands in moderate merge risk rather than a low-risk merge.
- A smaller hardening improvement is to set
persist-credentials: falsein.github/workflows/run-lighthouse-ci.yaml; low severity, but it reduces unnecessary token persistence. - Pay close attention to
.github/workflows/run-lighthouse-ci.yaml- increase timeout for multi-URL Lighthouse runs and tighten checkout credential handling.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/run-lighthouse-ci.yaml">
<violation number="1" location=".github/workflows/run-lighthouse-ci.yaml:24">
P3: Set `persist-credentials: false` on this checkout step. This workflow only runs Lighthouse against an already-deployed URL and never pushes back to the repo, so persisting the `GITHUB_TOKEN` in `.git/config` is unnecessary credential exposure to subsequent steps.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/run-lighthouse-ci.yaml (1)
31-36: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winOptional: Consider uploading Lighthouse reports as artifacts.
For debugging assertion failures, consider uploading the Lighthouse CI output directory (typically
.lighthouseci/) as workflow artifacts. This would provide detailed performance metrics when the job fails thresholds.📊 Proposed enhancement to upload artifacts
- name: Run lighthouse-ci env: LHCI_BASE_URL: ${{ inputs.base_url }} run: pnpm run lighthouse-ci working-directory: frontend + + - name: Upload Lighthouse reports + if: always() + uses: actions/upload-artifact@v4 + with: + name: lighthouse-reports + path: frontend/.lighthouseci/ + retention-days: 7🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/run-lighthouse-ci.yaml around lines 31 - 36, Add an artifacts upload step after the "Run lighthouse-ci" job step: after the step that uses run: pnpm run lighthouse-ci (working-directory: frontend, env LHCI_BASE_URL) add a step that uses actions/upload-artifact@v3 to upload the frontend/.lighthouseci directory (or .lighthouseci/**) and set the step conditional to always() so reports are uploaded even on failures; name the step clearly like "Upload Lighthouse reports" so it’s easy to find in the workflow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In @.github/workflows/run-lighthouse-ci.yaml:
- Around line 31-36: Add an artifacts upload step after the "Run lighthouse-ci"
job step: after the step that uses run: pnpm run lighthouse-ci
(working-directory: frontend, env LHCI_BASE_URL) add a step that uses
actions/upload-artifact@v3 to upload the frontend/.lighthouseci directory (or
.lighthouseci/**) and set the step conditional to always() so reports are
uploaded even on failures; name the step clearly like "Upload Lighthouse
reports" so it’s easy to find in the workflow.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: be0647a9-4d9e-4dc1-9ec0-4a911083bcea
📒 Files selected for processing (1)
.github/workflows/run-lighthouse-ci.yaml
| - name: Check out repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false |



Proposed change
Resolves #4707
Extracted run-lighthouse-ci into a separate reusable workflow
Checklist
make check-testlocally: all warnings addressed, tests passed