Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect cherry-pick conflicts #76

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/cherry-picker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ jobs:
git remote add other $OTHER_REPO_FULL.git -f --no-tags -t main -m main

commit_hash="$(git rev-parse refs/remotes/other/HEAD)"
git cherry-pick $commit_hash
title_prefix=
if ! git cherry-pick $commit_hash; then
git cherry-pick --abort
title_prefix="CHERRY-PICK CONFLICT "
git cherry-pick $commit_hash --strategy-option theirs
fi

remote_pr_id=$(gawk 'match($0, /\(#([0-9]+)\)$/, ary) {print ary[1]}' <<< $(git show -s --format=%s))
trimmed_commit_msg="$(sed -E '1 s/ \(#[0-9]+\)$//' <<< $(git show -s --format=%B))"
git commit --amend -m "$trimmed_commit_msg"

title_txt="$(git show -s --format=%s)"
title_txt="$title_prefix$(git show -s --format=%s)"
echo "title text is $title_txt"

remote_pr_body="$(gh pr view $remote_pr_id --repo $OTHER_REPO_FULL.git --json body --jq '.body')"
Expand Down