From 1b85771a57961d5e37d2d6a71cfaaa5d500f1298 Mon Sep 17 00:00:00 2001 From: dengfuping Date: Thu, 26 Dec 2024 10:35:28 +0800 Subject: [PATCH] fix(workflow): Remove pr-id.text in preview to avoid security problem --- .github/workflows/preview-build.yml | 12 ---------- .github/workflows/preview-deploy.yml | 36 ++++------------------------ 2 files changed, 5 insertions(+), 43 deletions(-) diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml index 768432b93..9907516f0 100644 --- a/.github/workflows/preview-build.yml +++ b/.github/workflows/preview-build.yml @@ -44,15 +44,3 @@ jobs: name: site path: site/ retention-days: 5 - - # Upload PR id for next workflow use - - name: Save PR id - if: ${{ always() }} - run: echo ${{ github.event.number }} > ./pr-id.txt - - - name: Upload PR id - if: ${{ always() }} - uses: actions/upload-artifact@v3 - with: - name: pr - path: ./pr-id.txt diff --git a/.github/workflows/preview-deploy.yml b/.github/workflows/preview-deploy.yml index 48cc56980..25feea8ea 100644 --- a/.github/workflows/preview-deploy.yml +++ b/.github/workflows/preview-deploy.yml @@ -20,19 +20,6 @@ jobs: if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} steps: - # get PR id first - - name: Download pr artifact - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - run_id: ${{ github.event.workflow_run.id }} - name: pr - - # save PR id to output - - name: Save PR id - id: pr - run: echo "::set-output name=id::$( + body-include: '' - number: ${{ steps.pr.outputs.id }} + number: ${{ github.event.number }} - name: The job has failed if: ${{ failure() }} @@ -68,7 +55,7 @@ jobs: body-include: '' - number: ${{ steps.pr.outputs.id }} + number: ${{ github.event.number }} build-site-failed: permissions: @@ -80,19 +67,6 @@ jobs: if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure' }} steps: - # get PR id first - - name: Download pr artifact - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - run_id: ${{ github.event.workflow_run.id }} - name: pr - - # Save PR id to output - - name: Save PR id - id: pr - run: echo "::set-output name=id::$( body-include: '' - number: ${{ steps.pr.outputs.id }} + number: ${{ github.event.number }}