Skip to content

Commit

Permalink
rm fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
wen587 committed Jul 11, 2024
1 parent 6351ac4 commit b024935
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/protect-file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b024935

Please sign in to comment.