Skip to content

Commit 1dc69ef

Browse files
committed
feat: ai for ci diff action
1 parent 48cbebd commit 1dc69ef

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ jobs:
7171
7272
- name: Report Compressed Size
7373
uses: ./
74+
env:
75+
AI_TOKEN: ${{ secrets.AI_TOKEN }}
7476
with:
7577
github_token: ${{ secrets.GITHUB_TOKEN }}
7678
file_path: 'examples/**/*/.rsdoctor/rsdoctor-data.json'

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ export default defineConfig({
6363
| `file_path` | Path to Rsdoctor JSON data file | Yes | - |
6464
| `target_branch` | Target branch for baseline comparison | No | `main` |
6565

66+
> AI-assisted analysis reads `AI_TOKEN` from the action step environment. Store it as a GitHub Actions secret in repository settings, then pass it to the step with `AI_TOKEN: ${{ secrets.AI_TOKEN }}`.
67+
6668
- `target_branch`: If you want to use a dynamic target branch (e.g., the PR base branch instead of a fixed main), use:
6769
`target_branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || github.event.repository.default_branch }}`
6870

@@ -137,6 +139,8 @@ jobs:
137139
138140
- name: Bundle Analysis
139141
uses: web-infra-dev/rsdoctor-action@main
142+
env:
143+
AI_TOKEN: ${{ secrets.AI_TOKEN }}
140144
with:
141145
file_path: 'dist/.rsdoctor/rsdoctor-data.json'
142146
target_branch: 'main'
@@ -217,4 +221,4 @@ pnpm run build
217221
cd examples/rsbuild-demo
218222
pnpm install
219223
pnpm run build
220-
```
224+
```

action.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: '@yifancong/bundle-action'
2-
description: 'A simple demo for checking compressed size differences'
2+
description: 'A simple demo for checking compressed size differences. Requires the AI_TOKEN secret for AI-assisted analysis.'
33
branding:
44
icon: 'archive'
55
color: 'purple'
@@ -21,10 +21,11 @@ inputs:
2121
default: ''
2222
type: string
2323
ai_model:
24-
description: 'AI model to use for degradation analysis (e.g. claude-3-5-haiku-latest, gpt-4o-mini). Provider is auto-detected from the model name prefix.'
24+
description: 'AI model to use for degradation analysis (e.g. claude-3-5-haiku-latest, gpt-4o-mini). Provider is auto-detected from the model name prefix. Set AI_TOKEN as a GitHub Actions secret and pass it to the action step for AI-assisted analysis.'
2525
required: false
2626
default: 'claude-3-5-haiku-latest'
27+
type: string
2728

2829
runs:
29-
using: 'node20'
30-
main: 'dist/index.js'
30+
using: 'node24'
31+
main: 'dist/index.js'

0 commit comments

Comments
 (0)