diff options
| author | Christian Marangi | 2024-11-16 14:00:45 +0000 |
|---|---|---|
| committer | Christian Marangi | 2024-11-16 14:00:45 +0000 |
| commit | deac687606522a8ba4266c294ed6df4cc3288490 (patch) | |
| tree | 56ac77149da1950f931fd120109f0267802b415c | |
| parent | 0f9a70649173e0ce53f71de53a2d07679667ab25 (diff) | |
| download | maintainer-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-x | github-merge-pr.sh | 8 |
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\" |