mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-27 18:45:05 +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
|
- name: Restore Context
|
||||||
run: |
|
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
|
- name: Set Deploy Name
|
||||||
run: |
|
run: |
|
||||||
echo "DEPLOY_NAME=deploy-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV
|
echo "DEPLOY_NAME=deploy-preview-${PR_NUMBER}" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
- name: Deploy to Netlify
|
- name: Deploy to Netlify
|
||||||
id: deploy
|
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
|
- name: Export Context
|
||||||
run: |
|
run: |
|
||||||
echo "PR_NUMBER=${{ github.event.number }}" >> ./action.env
|
echo "${{ github.event.pull_request.number }}" > ./pr-number
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@ -38,5 +38,5 @@ jobs:
|
|||||||
name: website-preview
|
name: website-preview
|
||||||
path: |
|
path: |
|
||||||
./website/build
|
./website/build
|
||||||
./action.env
|
./pr-number
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
Loading…
Reference in New Issue
Block a user