From c57f6cd8c3eb2a502e999fc21d91064a07c86147 Mon Sep 17 00:00:00 2001 From: Antheas Kapenekakis <5252246+antheas@users.noreply.github.com> Date: Sat, 16 Nov 2024 06:07:53 +0100 Subject: [PATCH] fix: prevent partial pushes causing partial changelogs (#1880) --- .github/workflows/changelog.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/changelog.py b/.github/workflows/changelog.py index 3b6b9f3e..59713aa7 100644 --- a/.github/workflows/changelog.py +++ b/.github/workflows/changelog.py @@ -131,17 +131,24 @@ def get_manifests(target: str): def get_tags(target: str, manifests: dict[str, Any]): tags = set() + # Select random manifest to get reference tags from + first = next(iter(manifests.values())) + for tag in first["RepoTags"]: + # Tags ending with .0 should not exist + if tag.endswith(".0"): + continue + if target != "stable": + if re.match(OTHER_START_PATTERN(target), tag): + tags.add(tag) + else: + if re.match(STABLE_START_PATTERN, tag): + tags.add(tag) + + # Remove tags not present in all images for manifest in manifests.values(): - for tag in manifest["RepoTags"]: - # Tags ending with .0 should not exist - if tag.endswith(".0"): - continue - if target != "stable": - if re.match(OTHER_START_PATTERN(target), tag): - tags.add(tag) - else: - if re.match(STABLE_START_PATTERN, tag): - tags.add(tag) + for tag in list(tags): + if tag not in manifest["RepoTags"]: + tags.remove(tag) tags = list(sorted(tags)) assert len(tags) > 2, "No current and previous tags found"