From e70025b87776245fd8672489b1c89c966d6c4fba Mon Sep 17 00:00:00 2001 From: cipchk Date: Fri, 29 Dec 2023 19:55:39 +0800 Subject: [PATCH] ci: fix pr number --- .github/workflows/ci.yml | 8 +++++--- scripts/github/comment.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfdf499b9..be776c595 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: jwalton/gh-find-current-pr@v1 + id: findPr - uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' @@ -22,7 +24,7 @@ jobs: env: ACCESS_REPO: ${{ github.repository }} ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR: ${{ github.event.number }} + PR_NUMBER: ${{ steps.findPr.outputs.pr }} - name: Build artifacts run: ./scripts/ci/build-artifacts.sh env: @@ -47,14 +49,14 @@ jobs: env: ACCESS_REPO: ${{ github.repository }} ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR: ${{ github.event.number }} + PR_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.GITHUB_TOKEN }} - PR: ${{ github.event.number }} + PR_NUMBER: ${{ steps.findPr.outputs.pr }} test: runs-on: ubuntu-latest diff --git a/scripts/github/comment.js b/scripts/github/comment.js index 8d56e9960..3f1f0be2e 100644 --- a/scripts/github/comment.js +++ b/scripts/github/comment.js @@ -1,6 +1,6 @@ const REPO = process.env.ACCESS_REPO; const TOKEN = process.env.ACCESS_TOKEN; -const PR = process.env.PR; +const PR = process.env.PR_NUMBER; const REPLACE_MARK = ''; const argv = process.argv;