From: Christian Marangi Date: Sat, 16 Nov 2024 14:00:45 +0000 (+0100) Subject: github-merge-pr: Prevent multiple Link: https://github.com/$REPO/pull/$PRID X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;p=maintainer-tools.git github-merge-pr: Prevent multiple Link: https://github.com/$REPO/pull/$PRID Prevent multiple Link: https://github.com/$REPO/pull/$PRID from being included in the commit by removing any already present entry with the same link. Signed-off-by: Christian Marangi --- diff --git a/github-merge-pr.sh b/github-merge-pr.sh index 1bd3e2f..825ff0b 100755 --- a/github-merge-pr.sh +++ b/github-merge-pr.sh @@ -138,6 +138,14 @@ if [ "$(echo "$PR_INFO" | jq -r ".maintainer_can_modify")" == "true" ] || [ "$IG exit 9 fi + # Remove any previous Link: https://github.com/$REPO/pull/$PRID tag + if ! $GIT filter-repo --message-callback " + return message.replace(b\"Link: https://github.com/$REPO/pull/$PRID\n\",b\"\") + " --refs $BRANCH..$LOCAL_PR_BRANCH --force; then + echo "Failed to remove previous Link: https://github.com/$REPO/pull/$PRID tag" >&2 + exit 9 + fi + # 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\"