Skip to content

Commit

Permalink
Fix check-release to handle new version-commit format.
Browse files Browse the repository at this point in the history
Checks for new-style first, checks for old-style if not found.
Some day, should prob check based on release-tag.

[noissue]
  • Loading branch information
ggainey committed Mar 19, 2024
1 parent 4fd782b commit 24de2b1
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions templates/github/.ci/scripts/check_release.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,31 @@ def main():
# Blobless clone does not have file contents for Z branches,
# check commit message for last Z bump
git_branch = f"origin/{branch}"
next_version = repo.git.log(
"--oneline", "--grep=Bump to", "-n 1", git_branch, "--", ".bumpversion.cfg"
).split("to")[-1]
next_version = None
bump_commit = repo.git.log(
"--oneline",
"--grep=Bump version",
"-n 1",
git_branch,
"--",
".bumpversion.cfg",
)
if bump_commit:
next_version = bump_commit.split("→ ")[-1]
# If not found - try old-commit-msg
if not next_version:
bump_commit = repo.git.log(
"--oneline",
"--grep=Bump to",
"-n 1",
git_branch,
"--",
".bumpversion.cfg",
)
next_version = bump_commit.split("to ")[-1] if bump_commit else None

# You could, theoretically, be next_vers==None here - but that's always
# been true for this script.
next_version = Version(next_version)
print(
f"A Z-release is needed for {branch}, "
Expand Down

0 comments on commit 24de2b1

Please sign in to comment.