From 3e7444e8fc5020844710f6fd9fce09dcb31f766d Mon Sep 17 00:00:00 2001 From: cipchk Date: Fri, 2 Feb 2024 16:01:41 +0800 Subject: [PATCH] ci: fix pr number --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7edacf004..7d809f2c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: env: ACCESS_REPO: ${{ github.repository }} ACCESS_TOKEN: ${{ secrets.CI_TOKEN }} - PR_NUMBER: ${{ steps.findPr.outputs.pr }} + PR_NUMBER: ${{ github.event.number ?? steps.findPr.outputs.pr }} - uses: actions/cache@v3 with: path: ./node_modules @@ -35,7 +35,7 @@ jobs: run: yarn run site:build - name: 'Deploy Site' run: | - export DEPLOY_DOMAIN=https://preview-${{ steps.findPr.outputs.pr }}-ng-alain-delon.surge.sh + export DEPLOY_DOMAIN=https://preview-${{ github.event.number ?? steps.findPr.outputs.pr }}-ng-alain-delon.surge.sh echo "Deploy to $DEPLOY_DOMAIN" cp ./src/dist/browser/index.html ./src/dist/browser/404.html npx surge --project ./src/dist/browser --domain $DEPLOY_DOMAIN @@ -46,19 +46,19 @@ jobs: SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} - name: 'Update comment on github' run: | - export DEPLOY_DOMAIN=https://preview-${{ steps.findPr.outputs.pr }}-ng-alain-delon.surge.sh + export DEPLOY_DOMAIN=https://preview-${{ github.event.number ?? steps.findPr.outputs.pr }}-ng-alain-delon.surge.sh node ./scripts/github/comment.js "[Preview is ready!]($DEPLOY_DOMAIN)" env: ACCESS_REPO: ${{ github.repository }} ACCESS_TOKEN: ${{ secrets.CI_TOKEN }} - PR_NUMBER: ${{ steps.findPr.outputs.pr }} + PR_NUMBER: ${{ github.event.number ?? steps.findPr.outputs.pr }} - name: 'When failed' if: failure() run: node ./scripts/github/comment.js "[Preview Build Failed!](https://github.com/ng-alain/delon/actions/runs/${{ github.run_id }})" env: ACCESS_REPO: ${{ github.repository }} ACCESS_TOKEN: ${{ secrets.CI_TOKEN }} - PR_NUMBER: ${{ steps.findPr.outputs.pr }} + PR_NUMBER: ${{ github.event.number ?? steps.findPr.outputs.pr }} test: runs-on: ubuntu-latest