From fc2b310fa95a43fb96ae1617723c3b61f88446f5 Mon Sep 17 00:00:00 2001 From: Christian Hoffmann Date: Sat, 18 Jun 2022 23:33:45 +0200 Subject: [PATCH] tools/changelog-helper: Ignore foreign-milestone PRs despite mentions in git log Previously, all PRs from the relevant git log were added to the ChangeLog. This causes false positives when older PRs are intentionally mentioned again (e.g. for further fixes or documentation updates). At the same time, simply skipping them removes an additional method to avoid forgotten PRs. Therefore, only add git-mentioned PRs if they don't have a milestone (or a matching one). Fixes: #2657 --- tools/changelog-helper.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/changelog-helper.sh b/tools/changelog-helper.sh index 9255d40c65..f4301b13a6 100755 --- a/tools/changelog-helper.sh +++ b/tools/changelog-helper.sh @@ -44,9 +44,15 @@ find_or_add_missing_entries() { target_ref="${target_release_tag}" fi echo - echo "Checking if all PR or references in git log since ${prev_release_tag} are included for ${target_release} based on ref ${target_ref}..." + echo "Checking if all PR references in git log since ${prev_release_tag} are included for ${target_release} based on ref ${target_ref}..." + local milestone for id in $(git log "${prev_release_tag}..master" | grep -oP '#\K(\d+)'); do gh pr view "${id}" --json title &> /dev/null || continue # Skip non-PRs + milestone=$(gh pr view "${id}" --json milestone --jq .milestone.title) + if [[ "${milestone}" =~ "Release " ]] && [[ "${milestone}" != "Release ${target_release}" ]]; then + echo "-> Ignoring PR #${id}, which was mentioned in 'git log ${prev_release_tag}..HEAD', but already has milestone '${milestone}'" + continue + fi check_or_add_pr "${id}" done