diff --git a/.github/workflows/website-preview-cd.yml b/.github/workflows/website-preview-cd.yml index ac8edbe4..8742b39e 100644 --- a/.github/workflows/website-preview-cd.yml +++ b/.github/workflows/website-preview-cd.yml @@ -45,11 +45,16 @@ jobs: - name: Restore Context run: | - cat action.env >> $GITHUB_ENV + PR_NUMBER=$(cat ./pr-number) + if ! [[ "${PR_NUMBER}" =~ ^[0-9]+$ ]]; then + echo "Invalid PR number: ${PR_NUMBER}" + exit 1 + fi + echo "PR_NUMBER=${PR_NUMBER}" >> "${GITHUB_ENV}" - name: Set Deploy Name run: | - echo "DEPLOY_NAME=deploy-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV + echo "DEPLOY_NAME=deploy-preview-${PR_NUMBER}" >> "${GITHUB_ENV}" - name: Deploy to Netlify id: deploy diff --git a/.github/workflows/website-preview-ci.yml b/.github/workflows/website-preview-ci.yml index 1898bd57..a2ddc5e7 100644 --- a/.github/workflows/website-preview-ci.yml +++ b/.github/workflows/website-preview-ci.yml @@ -30,7 +30,7 @@ jobs: - name: Export Context run: | - echo "PR_NUMBER=${{ github.event.number }}" >> ./action.env + echo "${{ github.event.pull_request.number }}" > ./pr-number - name: Upload Artifact uses: actions/upload-artifact@v4 @@ -38,5 +38,5 @@ jobs: name: website-preview path: | ./website/build - ./action.env + ./pr-number retention-days: 1