From ab71d3d7006b1d0acacdaf6801c2129edeaf38f2 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Tue, 14 Apr 2026 18:39:54 -0700 Subject: [PATCH] Also reject PRs from forks, not just non-allowlisted branches --- .github/workflows/guard-main-branch.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/guard-main-branch.yml b/.github/workflows/guard-main-branch.yml index a3a1f33fb2..3a84380e71 100644 --- a/.github/workflows/guard-main-branch.yml +++ b/.github/workflows/guard-main-branch.yml @@ -25,8 +25,15 @@ jobs: - name: Check head branch name env: HEAD_REF: ${{ github.head_ref }} + HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }} + BASE_REPO: ${{ github.repository }} run: | + echo "PR head repo: $HEAD_REPO" echo "PR head branch: $HEAD_REF" + if [ "$HEAD_REPO" != "$BASE_REPO" ]; then + echo "::error::PRs to main must originate from the canonical repository ($BASE_REPO), not a fork ($HEAD_REPO)." + exit 1 + fi if [ "$HEAD_REF" = "litellm_internal_staging" ] || [[ "$HEAD_REF" == litellm_hotfix_?* ]]; then echo "Allowed source branch." exit 0