Skip to content

Commit 4830505

Browse files
authored
Merge pull request #24 from raifdmueller/ci/lighthouse
ci: Lighthouse CI + skip claude-review on forks
2 parents a4f2cf0 + b210c9a commit 4830505

6 files changed

Lines changed: 4432 additions & 149 deletions

File tree

.github/workflows/claude-code-review.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ on:
1212

1313
jobs:
1414
claude-review:
15-
# Optional: Filter by PR author
16-
# if: |
17-
# github.event.pull_request.user.login == 'external-contributor' ||
18-
# github.event.pull_request.user.login == 'new-developer' ||
19-
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
15+
# Skip on fork PRs — the CLAUDE_CODE_OAUTH_TOKEN secret is not
16+
# available in fork-PR contexts (GitHub security model), so the
17+
# action would fail. For fork PRs, CodeRabbit provides AI review
18+
# and @claude mentions (via claude.yml) still work on demand.
19+
if: github.event.pull_request.head.repo.full_name == github.repository
2020

2121
runs-on: ubuntu-latest
2222
permissions:
@@ -41,4 +41,3 @@ jobs:
4141
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
4242
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
4343
# or https://code.claude.com/docs/en/cli-reference for available options
44-

.github/workflows/lighthouse.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Lighthouse CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
lhci:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Node
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '22'
18+
cache: 'npm'
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Build
24+
run: npm run build
25+
26+
- name: Start static server
27+
run: |
28+
npx http-server dist -p 5000 --silent &
29+
npx wait-on http://localhost:5000
30+
31+
- name: Run Lighthouse CI
32+
run: npx lhci autorun
33+
env:
34+
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ Thumbs.db
1515
.vscode/
1616
*.swp
1717
*.swo
18+
19+
# Lighthouse CI local results
20+
.lighthouseci/

lighthouserc.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"ci": {
3+
"collect": {
4+
"url": ["http://localhost:5000/"],
5+
"numberOfRuns": 3,
6+
"settings": {
7+
"preset": "desktop",
8+
"throttlingMethod": "simulate"
9+
}
10+
},
11+
"assert": {
12+
"assertions": {
13+
"categories:performance": ["error", { "minScore": 0.8 }],
14+
"categories:accessibility": ["error", { "minScore": 0.85 }],
15+
"categories:best-practices": ["error", { "minScore": 0.9 }],
16+
"categories:seo": ["error", { "minScore": 0.95 }],
17+
"largest-contentful-paint": ["warn", { "maxNumericValue": 2500 }],
18+
"total-blocking-time": ["warn", { "maxNumericValue": 300 }],
19+
"cumulative-layout-shift": ["warn", { "maxNumericValue": 0.1 }]
20+
}
21+
},
22+
"upload": {
23+
"target": "temporary-public-storage"
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)