From 823b230d0d5743f38da2fefbebbee228353c56ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Tue, 23 Jul 2024 13:23:01 +0800 Subject: [PATCH] ci: fix diff failed when get empty pr id (#50019) --- .github/workflows/visual-regression-diff-finish.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/visual-regression-diff-finish.yml b/.github/workflows/visual-regression-diff-finish.yml index b7e949ec2b..e58c726558 100644 --- a/.github/workflows/visual-regression-diff-finish.yml +++ b/.github/workflows/visual-regression-diff-finish.yml @@ -78,7 +78,13 @@ jobs: # Save PR id to output - name: save PR id id: pr - run: echo "id=$(> $GITHUB_OUTPUT + run: | + pr_id=$(> $GITHUB_OUTPUT # Download report artifact - name: download report artifact @@ -146,13 +152,15 @@ jobs: - name: Reset Commit Status uses: actions/github-script@v7 if: ${{ steps.report.outcome == 'success' }} + env: + PR_ID: ${{ steps.pr.outputs.id }} with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const prResponse = await github.rest.pulls.get({ owner: context.repo.owner, repo: context.repo.repo, - pull_number: ${{ steps.pr.outputs.id }}, + pull_number: process.env.PR_ID, }); const prHeadSha = prResponse.data.head.sha;