From 823c9ae6d26a23bc8a1d96102f8b4e20ba732a72 Mon Sep 17 00:00:00 2001 From: Chintan Kavathia Date: Mon, 2 Dec 2024 16:54:00 +0530 Subject: [PATCH] test Revert "test" This reverts commit 7a9f7f4dbf02ad7ab7edd9b073c8467a6de96526. test test test --- .github/workflows/test_and_deploy.yml | 47 ++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 7c0b4fb45..68bf29d04 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -17,23 +17,52 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 # Ensure full history is fetched + + - name: Add upstream remote + run: | + # Add the upstream repository (base repo) + echo "Adding upstream remote..." + git remote add upstream https://github.com/siemens/ngx-datatable.git + git fetch upstream + echo "Upstream remote added and fetched." + + - name: Fetch PR Branch from Fork + run: | + echo "Fetching PR branch from fork..." + git fetch origin ${{ github.head_ref }}:refs/remotes/origin/${{ github.head_ref }} + echo "Fetched PR branch: ${{ github.head_ref }}" + + - name: Attach to PR Branch + run: | + echo "Checking out the PR branch: ${{ github.head_ref }}" + git checkout ${{ github.head_ref }} + echo "Checked out branch: ${{ github.head_ref }}" - - name: Fetch all branches + - name: Fetch the latest upstream master (or main) branch run: | - git fetch --all + echo "Fetching latest master from upstream..." + git fetch upstream master # or main if that's your default branch + echo "Fetched latest master branch from upstream." - - name: Check for divergence from master + - name: Verify PR and Upstream master State run: | - git fetch origin master - UPSTREAM=${{ github.base_ref }} # Target branch of the pull request (usually master) - CURRENT=$(git rev-parse HEAD) # Latest commit on the PR branch - MERGED=$(git merge-base HEAD origin/$UPSTREAM) # Common ancestor between HEAD and master + UPSTREAM=master # Use 'main' if your default branch is named 'main' + echo "Target upstream branch: $UPSTREAM" + CURRENT=$(git rev-parse HEAD) + MERGED=$(git merge-base HEAD upstream/$UPSTREAM) + + echo "Current commit hash: $CURRENT" + echo "Merged commit hash: $MERGED" + # Check if the branch is rebased or not if [ "$MERGED" != "$CURRENT" ]; then - echo "This branch is not rebased with the latest master." + echo "This branch is not rebased with the latest $UPSTREAM." + echo "Run 'git rebase upstream/$UPSTREAM' locally to fix this." exit 1 else - echo "This branch is up-to-date with master." + echo "Branch is up-to-date with $UPSTREAM." fi build: