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