github-merge-pr: use --force for filter-repo commands
authorChristian Marangi <ansuelsmth@gmail.com>
Mon, 29 Apr 2024 10:22:37 +0000 (12:22 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Mon, 29 Apr 2024 10:22:37 +0000 (12:22 +0200)
Use --force for filter-repo commands to handle special branch merged by
Committer that wouldn't be fresh copy as required by filter-repo
commands.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
github-merge-pr.sh

index b2c94b5d91947a8f75be9e0103d5563c765680bc..4a61a3f04381c7e3a35006633b3e587b9dd39ac8 100755 (executable)
@@ -123,7 +123,7 @@ if [ "$(echo "$PR_INFO" | jq -r ".maintainer_can_modify")" == "true" ]; then
        # Add to each commit Link: https://github.com/$REPO/pull/$PRID
        if ! $GIT filter-repo --message-callback "
                return message + b\"Link: https://github.com/$REPO/pull/$PRID\"
-       " --refs $BRANCH..$LOCAL_PR_BRANCH; then
+       " --refs $BRANCH..$LOCAL_PR_BRANCH --force; then
                echo "Failed to add Link: Pull Request tag" >&2
                exit 9
        fi
@@ -131,7 +131,7 @@ if [ "$(echo "$PR_INFO" | jq -r ".maintainer_can_modify")" == "true" ]; then
        # Remove any previous SoB tag if the Pull Request Author and Committer match
        if ! $GIT filter-repo --message-callback "
                return message.replace(b\"Signed-off-by: $(git config user.name) <$(git config user.email)>\",b\"\")
-       " --refs $BRANCH..$LOCAL_PR_BRANCH; then
+       " --refs $BRANCH..$LOCAL_PR_BRANCH --force; then
                echo "Failed to remove previous Committer SoB tag" >&2
                exit 9
        fi