安全:[skip ci] 限制环境晋级来源仓库
This commit is contained in:
@@ -16,11 +16,20 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
TARGET_BRANCH: ${{ gitea.base_ref }}
|
TARGET_BRANCH: ${{ gitea.base_ref }}
|
||||||
SOURCE_BRANCH: ${{ gitea.head_ref }}
|
SOURCE_BRANCH: ${{ gitea.head_ref }}
|
||||||
|
SOURCE_REPOSITORY: ${{ gitea.event.pull_request.head.repo.full_name }}
|
||||||
|
TARGET_REPOSITORY: ${{ gitea.repository }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
test -n "$TARGET_BRANCH"
|
test -n "$TARGET_BRANCH"
|
||||||
test -n "$SOURCE_BRANCH"
|
test -n "$SOURCE_BRANCH"
|
||||||
|
test -n "$SOURCE_REPOSITORY"
|
||||||
|
test -n "$TARGET_REPOSITORY"
|
||||||
|
|
||||||
|
if [[ "$SOURCE_REPOSITORY" != "$TARGET_REPOSITORY" ]]; then
|
||||||
|
echo "拒绝跨仓库环境晋级:$SOURCE_REPOSITORY -> $TARGET_REPOSITORY"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
case "$TARGET_BRANCH:$SOURCE_BRANCH" in
|
case "$TARGET_BRANCH:$SOURCE_BRANCH" in
|
||||||
sit:dev|prod:sit)
|
sit:dev|prod:sit)
|
||||||
|
|||||||
Reference in New Issue
Block a user