From cd24aaf3aa2fc32fdf2a246229e070abec5b50d0 Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Mon, 28 Jul 2025 13:11:56 -0700 Subject: [PATCH] fix(pre-commit): push properly version 4 --- .github/workflows/pre-commit.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index d0faf0711..4f1c143d2 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -53,11 +53,17 @@ jobs: if ! git diff --exit-code || [ -n "$(git ls-files --others --exclude-standard)" ]; then git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" + + # Ensure we're on the correct branch + git checkout -B ${{ github.head_ref }} git add -A git commit -m "Apply pre-commit fixes" - # push to the PR branch - git push origin HEAD:${{ github.head_ref }} + # Pull latest changes from the PR branch and rebase our commit on top + git pull --rebase origin ${{ github.head_ref }} + + # Push to the PR branch + git push origin ${{ github.head_ref }} echo "Pre-commit fixes committed and pushed" else echo "No changes to commit"