summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Marangi2024-11-16 14:00:45 +0000
committerChristian Marangi2024-11-16 14:00:45 +0000
commitdeac687606522a8ba4266c294ed6df4cc3288490 (patch)
tree56ac77149da1950f931fd120109f0267802b415c
parent0f9a70649173e0ce53f71de53a2d07679667ab25 (diff)
downloadmaintainer-tools-deac687606522a8ba4266c294ed6df4cc3288490.tar.gz
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 <ansuelsmth@gmail.com>
-rwxr-xr-xgithub-merge-pr.sh8
1 files changed, 8 insertions, 0 deletions
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\"