Skip to content

Commit 09651b1

Browse files
committed
fix: review suggestion
1 parent b004883 commit 09651b1

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/pr-ci-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
3030

3131
- name: Setup pnpm cache
32-
uses: actions/cache@v3
32+
uses: actions/cache@v4
3333
with:
3434
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
3535
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}

.github/workflows/pr-ci-e2e-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
2626

2727
- name: Setup pnpm cache
28-
uses: actions/cache@v3
28+
uses: actions/cache@v4
2929
with:
3030
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
3131
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}

.github/workflows/pr-ci-preview.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: 'CI: Preview'
22

33
on:
44
workflow_call:
5+
inputs:
6+
pr-number:
7+
description: 'Pull Request number'
8+
type: number
9+
required: true
510

611
jobs:
712
preview-job:
@@ -25,7 +30,7 @@ jobs:
2530
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
2631

2732
- name: Setup pnpm cache
28-
uses: actions/cache@v3
33+
uses: actions/cache@v4
2934
with:
3035
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
3136
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
@@ -55,7 +60,7 @@ jobs:
5560
🔨 Building packages...
5661
<!-- TINY_ROBOT_BUILD -->
5762
body-include: '<!-- TINY_ROBOT_BUILD -->'
58-
number: ${{ github.event.number }}
63+
number: ${{ inputs.pr-number }}
5964

6065
- name: Publish to pkg.pr.new
6166
id: pkg-pr-new
@@ -118,7 +123,7 @@ jobs:
118123
- name: Deploy Site to Surge
119124
id: deploy
120125
run: |
121-
DEPLOY_DOMAIN=preview-${{ github.event.number }}-tiny-robot.surge.sh
126+
DEPLOY_DOMAIN=preview-${{ inputs.pr-number }}-tiny-robot.surge.sh
122127
echo "Deploying to: https://$DEPLOY_DOMAIN"
123128
npx surge --project ./docs/dist --domain $DEPLOY_DOMAIN --token $SURGE_TOKEN
124129
echo "url=https://$DEPLOY_DOMAIN" >> $GITHUB_OUTPUT
@@ -131,15 +136,15 @@ jobs:
131136
with:
132137
token: ${{ secrets.GITHUB_TOKEN }}
133138
body: |
134-
[<img width="400" src="https://github.com/user-attachments/assets/2a0bb639-dfaf-4384-8d73-cec616ea4b97">](https://preview-${{ github.event.number }}-tiny-robot.surge.sh)
139+
[<img width="400" src="https://github.com/user-attachments/assets/2a0bb639-dfaf-4384-8d73-cec616ea4b97">](https://preview-${{ inputs.pr-number }}-tiny-robot.surge.sh)
135140
136141
✅ Preview build completed successfully!
137142
138143
> Click the image above to preview.
139144
> Preview will be automatically removed when this PR is closed.
140145
<!-- TINY_ROBOT_BUILD -->
141146
body-include: '<!-- TINY_ROBOT_BUILD -->'
142-
number: ${{ github.event.number }}
147+
number: ${{ inputs.pr-number }}
143148

144149
- name: Comment build failed
145150
if: ${{ failure() && github.event_name == 'pull_request' }}
@@ -152,4 +157,4 @@ jobs:
152157
❌ Build failed. Please check the logs for details.
153158
<!-- TINY_ROBOT_BUILD -->
154159
body-include: '<!-- TINY_ROBOT_BUILD -->'
155-
number: ${{ github.event.number }}
160+
number: ${{ inputs.pr-number }}

.github/workflows/pr-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
needs: [build]
3434
if: github.event_name == 'pull_request'
3535
uses: ./.github/workflows/pr-ci-preview.yml
36+
with:
37+
pr-number: ${{ github.event.pull_request.number }}
3638
secrets: inherit
3739

3840
# E2E 测试(依赖构建,与预览并行)

0 commit comments

Comments
 (0)