diff --git a/.gitea/workflows/environment-promotion-guard.yml b/.gitea/workflows/environment-promotion-guard.yml index e3d36f3a..b895d6bd 100644 --- a/.gitea/workflows/environment-promotion-guard.yml +++ b/.gitea/workflows/environment-promotion-guard.yml @@ -16,11 +16,20 @@ jobs: env: TARGET_BRANCH: ${{ gitea.base_ref }} SOURCE_BRANCH: ${{ gitea.head_ref }} + SOURCE_REPOSITORY: ${{ gitea.event.pull_request.head.repo.full_name }} + TARGET_REPOSITORY: ${{ gitea.repository }} run: | set -euo pipefail test -n "$TARGET_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 sit:dev|prod:sit)