mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 00:55:07 +08:00
🔒 Security: restrict workflow context (#3124)
Co-authored-by: polarathene <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
parent
3bf393444d
commit
83552d6995
9
.github/workflows/website-preview-cd.yml
vendored
9
.github/workflows/website-preview-cd.yml
vendored
@ -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
|
||||
|
4
.github/workflows/website-preview-ci.yml
vendored
4
.github/workflows/website-preview-ci.yml
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user