@@ -14,7 +14,6 @@ permissions:
1414
1515jobs :
1616 deploy :
17- if : contains(github.event.pull_request.labels.*.name, 'prerelease')
1817 runs-on : ubuntu-latest
1918 strategy :
2019 matrix :
@@ -27,13 +26,27 @@ jobs:
2726 secret_project_id : VERCEL_PROJECT_ZH_HANT_ID
2827 name : Deploy ${{ matrix.locale }}
2928 steps :
29+ # Calculate if this matrix job should run based on PR labels
30+ - name : Calculate should_deploy
31+ id : should_deploy
32+ run : |
33+ if [[ "${{ github.event_name }}" != "pull_request" ]] || \
34+ [[ "${{ github.event.pull_request.labels.*.name }}" == *prerelease* ]] || \
35+ [[ "${{ github.event.pull_request.labels.*.name }}" == *prerelease:${{ matrix.locale }}* ]]; then
36+ echo "should_deploy=true" >> $GITHUB_OUTPUT
37+ else
38+ echo "should_deploy=false" >> $GITHUB_OUTPUT
39+ fi
3040 - name : Checkout code
41+ if : steps.should_deploy.outputs.should_deploy == 'true'
3142 uses : actions/checkout@v3
3243 with :
3344 fetch-depth : 1
3445 - name : Setup Tools
46+ if : steps.should_deploy.outputs.should_deploy == 'true'
3547 uses : ./.github/actions/setup
3648 - name : Deploy to Vercel (${{ matrix.locale }})
49+ if : steps.should_deploy.outputs.should_deploy == 'true'
3750 id : deploy
3851 uses : ./.github/actions/vercel-deploy
3952 with :
4255 vercel_org_id : ${{ secrets.VERCEL_ORG_ID }}
4356 vercel_token : ${{ secrets.VERCEL_TOKEN }}
4457 - name : Comment PR with Vercel Preview Links (${{ matrix.locale }})
58+ if : steps.should_deploy.outputs.should_deploy == 'true'
4559 uses : ./.github/actions/comment-vercel-preview
4660 with :
4761 inspect_url : ${{ steps.deploy.outputs.inspect_url }}
0 commit comments