From dd944cb5a577969df1b90c63bd00a14bfa0655f2 Mon Sep 17 00:00:00 2001 From: Aleksana <42209822+Aleksanaa@users.noreply.github.com> Date: Mon, 15 Aug 2022 13:11:10 +0800 Subject: [PATCH] add some magic to merge to parent branch This commit make it merge to parent branch instead of `master` branch, i.e. you are working on a branch called `refactor` and making a branch `release/2.0`, changes will be applied to `refactor` instead of `master`. --- .github/workflows/release.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a0929856..197dcdc6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -94,7 +94,13 @@ jobs: - name: Merge branch and push run: | - git checkout master + parent=$(git show-branch \ + | grep -F '*' \ + | grep -v "$(git rev-parse --abbrev-ref HEAD)" \ + | head -n1 \ + | sed 's/.*\[\(.*\)\].*/\1/' \ + | sed 's/[\^~].*//') + git checkout ${parent} git merge release/${{ env.BUILDVER }} --allow-unrelated-histories git pull && git push && git push --tags