Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/lighthouse_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Lighthouse CI

on:
workflow_dispatch:

permissions:
contents: read
pull-requests: write
issues: write

jobs:
lighthouse:
runs-on: ubuntu-latest

steps:
# 1. Checkout code
- name: Checkout repo
uses: actions/checkout@v4

# 2. Setup Node
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18

# 3. Install dependencies (if needed)
- name: Install dependencies
run: npm install

# 4. Build project (if React/Vite)
- name: Build project
run: npm run build

# 5. Run Lighthouse CI
- name: Run Lighthouse CI
uses: treosh/lighthouse-ci-action@v11
with:
urls: |
https://your-live-site-url.com
uploadArtifacts: true

# 6. Generate comment file
- name: Create Lighthouse comment
run: |
echo "## 🚀 Lighthouse Report" > lighthouse-comment.md
echo "Check performance report in artifacts." >> lighthouse-comment.md

# 7. Post comment on PR
- name: Post Lighthouse comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body-path: lighthouse-comment.md
edit-mode: replace