@@ -2,6 +2,11 @@ name: 'CI: Preview'
22
33on :
44 workflow_call :
5+ inputs :
6+ pr-number :
7+ description : ' Pull Request number'
8+ type : number
9+ required : true
510
611jobs :
712 preview-job :
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') }}
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 }}
0 commit comments