Remove automatic conflict resolution for merge from release branch (#4362)

This commit is contained in:
Francisco
2023-06-16 15:42:19 -03:00
committed by GitHub
parent cd48b3eab3
commit 002a7c8812
2 changed files with 6 additions and 29 deletions

View File

@ -1,27 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
# Define merge branch name
MERGE_BRANCH=merge/$GITHUB_REF_NAME
# Create the branch and force to start from ref
git checkout -B "$MERGE_BRANCH" "$GITHUB_REF_NAME"
# Get deleted changesets in this branch that might conflict with master
# --diff-filter=D - Only deleted files
readarray -t DELETED_CHANGESETS < <(git diff origin/master --diff-filter=D --name-only -- '.changeset/*.md')
# Merge master, which will take those files cherry-picked. Auto-resolve conflicts favoring master.
# Ignore conflicts that can't be resolved.
git merge origin/master -m "Merge master to $GITHUB_REF_NAME" -X theirs || true
# Remove the originally deleted changesets to correctly sync with master
rm -f "${DELETED_CHANGESETS[@]}"
# Only git add deleted files
git ls-files --deleted .changeset/ | xargs git add
# Allow empty here since there may be no changes if `rm -f` failed for all changesets
git commit --allow-empty -m "Sync changesets with master"
git push -f origin "$MERGE_BRANCH"