diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index eb3ca157e..c9db8188c 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -18,14 +18,18 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Fetch all branches + - name: Attach to PR Branch + run: | + git checkout -B ${{ github.head_ref }} origin/${{ github.head_ref }} + echo "Checked out branch: ${{ github.head_ref }}" + + - name: Fetch Master Branch run: | - git fetch --all + git fetch --verbose origin master || (echo "Git fetch failed"; exit 1) - - name: Check for divergence from master + - name: Check Rebase Status run: | - git fetch origin master - UPSTREAM=master # Change this to `main` if applicable + UPSTREAM=master # Replace with `main` if needed CURRENT=$(git rev-parse HEAD) MERGED=$(git merge-base HEAD origin/$UPSTREAM) @@ -34,12 +38,14 @@ jobs: echo "MERGED commit hash: $MERGED" if [ "$MERGED" != "$CURRENT" ]; then - echo "This branch is not rebased with the latest master." + echo "Branch is not rebased with $UPSTREAM." + echo "CURRENT: $CURRENT" + echo "MERGED: $MERGED" + echo "Rebase your branch onto the latest $UPSTREAM." exit 1 else - echo "This branch is up-to-date with master." + echo "Branch is up-to-date with $UPSTREAM." fi - build: needs: check-rebase runs-on: ubuntu-latest