Skip to content

Commit

Permalink
Update merge_ff_only.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
pbhandar-amd authored Aug 29, 2024
1 parent 770c884 commit 2ad27a7
Showing 1 changed file with 2 additions and 86 deletions.
88 changes: 2 additions & 86 deletions .github/workflows/merge_ff_only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,92 +48,8 @@ jobs:
git branch --track "$TARGET_BRANCH-target-repo" remotes/target-repo/$TARGET_BRANCH
echo "After tracking target branch external"
git switch -q "$TARGET_BRANCH-target-repo"
# echo "switched to $TARGET_BRANCH-external"
# echo "before merging"
# merge_msg=$(git merge $SOURCE_BRANCH --no-commit || echo " ")
# merge_msg=$(git merge $SOURCE_BRANCH --no-commit || echo " ")
# merge_msg=$(git merge $SOURCE_BRANCH --ff-only || echo " ")
#merge_msg=$(git merge $SOURCE_BRANCH || echo " ")
git merge $SOURCE_BRANCH --ff-only
git push -q target-repo HEAD:$TARGET_BRANCH
# # echo "after merging"
# # echo "before status"
# git status --porcelain
# #is_merge_conflict=$(git status --porcelain | egrep ^U)
# is_merge_conflict=$(git status --porcelain | egrep ^U || echo "")
# # echo "after status"
# if [ -z "$is_merge_conflict" ] ; then
# merge_status=0
# else
# merge_status=1
# fi
# echo "Value of merge_msg is:"
# echo "${merge_msg}"
# echo ""
# echo "Value of merge_status: $merge_status"
# if [ "$merge_status" -eq 0 ]; then
# # pushes local develop-external branch to external repo's 'develop' branch
# # git add -A
# # diff_files=$(git diff --name-only --cached)
# # if [ -z "$diff_files" ]; then
# # echo "No files to be promoted to external $TARGET_BRANCH so nothing to merge"
# # exit 0
# # fi
# # echo "Merge $SOURCE_BRANCH into $TARGET_BRANCH-external"
# # git commit -m "Promote internal $SOURCE_BRANCH into external $TARGET_BRANCH"
# git push -q external HEAD:develop
# echo "Merged changes from internal $SOURCE_BRANCH to external $TARGET_BRANCH successfully"
# else
# echo "Encountered a merge conflict when doing a git merge from $SOURCE_BRANCH to $TARGET_BRANCH. We'll create a PR instead"
# dev_branch_count=$(git ls-remote --heads external --list "refs/heads/${DEV_BRANCH}*" | wc -l | xargs)
# echo "Value of dev_branch_count: $dev_branch_count"
# git merge --abort
# if [ "$dev_branch_count" -gt 0 ]; then
# dev_branch_count=$((dev_branch_count + 1))
# echo "Remote branch with the name $TARGET_BRANCH already exists, so we create a branch with the name '${TARGET_BRANCH}-${dev_branch_count}' instead."
# DEV_BRANCH="${TARGET_BRANCH}-${dev_branch_count}"
# git switch -q "$SOURCE_BRANCH"
# git checkout -q -b "$DEV_BRANCH"
# fi
# git push -q external "$DEV_BRANCH"
# #if [ "$dev_branch_count" -gt 0 ]; then
# echo "Create a PR from $DEV_BRANCH into $TARGET_BRANCH and let user resolve merge conflicts manually"
# gh pr create --repo $ROCM_INSTALL_PUBLIC_REPO -B $TARGET_BRANCH -H $DEV_BRANCH --title "[Promote]: Promote internal $SOURCE_BRANCH into $TARGET_BRANCH" --body "Created by Github action" --draft
# #fi
# fi
# # commit_msg=$(git commit -m "Sync internal $SOURCE_BRANCH to external $TARGET_BRANCH" || echo "error") internal commit test
# # echo "Value of commit_msg: $commit_msg" force merge conflict
# # commit_status=${PIPESTATUS[0]}
# # echo "Value of commit_status is $commit_status"
# # if egrep -q "no changes added to commit|nothing to commit, working tree clean|nothing added to commit but untracked files present" <<< "$commit_msg"; then
# # echo "External branch $TARGET_BRANCH is up to date. Nothing to commit"
# # exit 0
# # elif [ "$commit_status" -eq 0 ]; then
# # git push external "$TARGET_BRANCH-external"
# #elif [ "$commit_status" -eq 128 ]; then
# # Encountered some unknown error when merging internal develop into external
# # Create a PR instead
# # else
# # dev_branch_count=$(git ls-remote --heads external --list "refs/heads/${DEV_BRANCH}*" | wc -l | xargs)
# # echo "Value of dev_branch_count: $dev_branch_count"
# # if [ "$dev_branch_count" -gt 0 ]; then
# # dev_branch_count=$((dev_branch_count + 1))
# # echo "Remote branch with the name $TARGET_BRANCH already exists, so we create a branch with the name '${TARGET_BRANCH}-${dev_branch_count}' instead."
# # DEV_BRANCH="${TARGET_BRANCH}-${dev_branch_count}"
# # git checkout -b "$DEV_BRANCH"
# # fi
# # git push external "$DEV_BRANCH"
# # #if [ "$dev_branch_count" -gt 0 ]; then
# # gh pr create --repo $ROCM_INSTALL_PUBLIC_REPO -B $TARGET_BRANCH -H $DEV_BRANCH --title "[Promote]: Promote internal $SOURCE_BRANCH into $TARGET_BRANCH" --body "Created by Github action" --draft
# # #fi
# # fi

0 comments on commit 2ad27a7

Please sign in to comment.