Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
chintankavathia committed Dec 2, 2024
1 parent 02cf12c commit dcc71c4
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,36 @@ jobs:
git fetch upstream master # or main if that's your default branch
echo "Fetched latest master branch from upstream."
- name: Verify PR and Upstream master State
- name: Check if PR branch is rebased onto master
run: |
UPSTREAM=master # Use 'main' if your default branch is named 'main'
echo "Target upstream branch: $UPSTREAM"
# Get the current and merged commit hashes
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 PR branch contains commits not part of master
# Use git log to check for commits in the PR branch that are not in upstream/master
PR_COMMITS=$(git log upstream/$UPSTREAM..HEAD --oneline)
# Check if the branch is rebased or not
if [ -n "$PR_COMMITS" ]; then
echo "This branch contains additional commits that are intended for merging into $UPSTREAM."
echo "Ignoring these commits as they are already part of the intended changes."
else
echo "Branch is up-to-date with $UPSTREAM."
fi
# Proceed with checking if the PR branch is based on the latest master
if [ "$MERGED" != "$CURRENT" ]; then
echo "This branch is not rebased with the latest $UPSTREAM."
echo "Run 'git rebase upstream/$UPSTREAM' locally to fix this."
exit 1
else
echo "Branch is up-to-date with $UPSTREAM."
echo "Branch is rebased and up-to-date with $UPSTREAM."
fi
build:
Expand Down

0 comments on commit dcc71c4

Please sign in to comment.