summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortranch <tranch.xiao@gmail.com>2026-10-16 01:18:48 +0800
committertranch <tranch.xiao@gmail.com>2026-10-16 01:18:48 +0800
commit0891c70f559c7d23a306290334388853ff317181 (patch)
tree219c0840868e7494fc50d24ea952fdaaebefedd2
parentf7c095592475d22e6d1d263b988c8a7974882521 (diff)
downloadAeroCore-OS-0891c70f559c7d23a306290334388853ff317181.tar.gz
AeroCore-OS-0891c70f559c7d23a306290334388853ff317181.zip
fix: tolerate unavailable changelog revisions
-rw-r--r--.github/scripts/generate_changelog.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/.github/scripts/generate_changelog.py b/.github/scripts/generate_changelog.py
index 2486fb6..4c5d7c1 100644
--- a/.github/scripts/generate_changelog.py
+++ b/.github/scripts/generate_changelog.py
@@ -225,16 +225,23 @@ def main() -> None:
start_revision = previous_info.get("Labels", {}).get("org.opencontainers.image.revision")
end_revision = current_info.get("Labels", {}).get("org.opencontainers.image.revision")
- aerocore_commits = (
- [
- (item.split("\t", 2)[0], item.split("\t", 2)[1], item.split("\t", 2)[2])
- for item in run(
- "git", "log", "--format=%H%x09%s%x09%an", f"{start_revision}..{end_revision}"
- ).splitlines()
- ]
- if start_revision and end_revision and start_revision != end_revision
- else []
- )
+ aerocore_commits: list[tuple[str, str, str]] = []
+ if start_revision and end_revision and start_revision != end_revision:
+ try:
+ aerocore_commits = [
+ (item.split("\t", 2)[0], item.split("\t", 2)[1], item.split("\t", 2)[2])
+ for item in run(
+ "git", "log", "--format=%H%x09%s%x09%an", f"{start_revision}..{end_revision}"
+ ).splitlines()
+ ]
+ except subprocess.CalledProcessError as error:
+ # Release metadata can point to revisions outside this checkout's
+ # history after histories are joined or rewritten. Keep the package
+ # and upstream changelog sections and omit only AeroCore commits.
+ print(
+ "Warning: unable to determine AeroCore 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 base_image: