From b02493519e14058e70926255c0834b621b97b372 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Thu, 11 Jul 2024 12:20:43 +0000 Subject: [PATCH] rm fetch --- .github/workflows/protect-file.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/protect-file.yml b/.github/workflows/protect-file.yml index 645d6c0e9ea4..809a9f2a6096 100644 --- a/.github/workflows/protect-file.yml +++ b/.github/workflows/protect-file.yml @@ -28,11 +28,8 @@ jobs: echo "Starting file check step" base_ref=$(echo "${GITHUB_CONTEXT}" | jq -r ".base_ref") echo "Base branch reference extracted: ${base_ref}" - protected_file="src/sonic-config-engine/minigraph.py" - git fetch origin $base_ref # Fetch the base branch to ensure it's up-to-date - base_branch=$(git rev-parse origin/$base_ref) - echo "Base branch SHA: $base_branch" - echo "Running git diff check" + protected_file='src/sonic-config-engine/minigraph.py' + base_branch=$(git rev-parse origin/${base_ref}) if git diff --name-only $base_branch | grep -q "^${protected_file}\$"; then echo "Error: You are trying to modify ${protected_file}, which is protected." exit 1