diff options
| author | tranch <tranch.xiao@gmail.com> | 2026-09-14 00:12:41 +0800 |
|---|---|---|
| committer | tranch <tranch.xiao@gmail.com> | 2026-09-14 00:12:41 +0800 |
| commit | a6a27050efa50c444816905a4c628adc68e8dd12 (patch) | |
| tree | a61a837a9aa0f14b0e6d451ec0cd71e7b2493c04 | |
| parent | 796c6c8a70c92d4675df7c2ec2d25ecda139d723 (diff) | |
| download | AeroCore-OS-a6a27050efa50c444816905a4c628adc68e8dd12.tar.gz AeroCore-OS-a6a27050efa50c444816905a4c628adc68e8dd12.zip | |
fix release changelog for unrelated histories44.20260913.1
| -rw-r--r-- | .github/scripts/generate_changelog.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/.github/scripts/generate_changelog.py b/.github/scripts/generate_changelog.py index 57f7ba9..c4ea8a2 100644 --- a/.github/scripts/generate_changelog.py +++ b/.github/scripts/generate_changelog.py @@ -109,11 +109,25 @@ def main() -> None: previous_info = image_info(args.image, previous) if previous else {} start_revision = previous_info.get("Labels", {}).get("org.opencontainers.image.revision") end_revision = current_info.get("Labels", {}).get("org.opencontainers.image.revision") - commits = ( - run("git", "log", "--format=%H%x09%s%x09%an", f"{start_revision}..{end_revision}").splitlines() - if start_revision and end_revision - else [] - ) + commits: list[str] = [] + if start_revision and end_revision: + try: + commits = run( + "git", + "log", + "--format=%H%x09%s%x09%an", + f"{start_revision}..{end_revision}", + ).splitlines() + except subprocess.CalledProcessError as error: + # A release may be built after histories are intentionally joined + # or rewritten. In that case the previous image revision can be + # valid metadata but not a reachable Git revision in this checkout. + # Package changes and the release itself remain valid, so omit the + # commit section instead of failing the whole release job. + print( + "Warning: unable to determine commit range " + f"{start_revision}..{end_revision}: {error}" + ) lines = [args.handwritten.strip() or f"This is an automatically generated changelog for release `{args.current}`.", ""] if previous: |
