Skip to content

Commit

Permalink
fix release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh committed Jun 20, 2024
1 parent 7a53ea9 commit eea3368
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ jobs:
needs: [checks]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v5
Expand Down
9 changes: 6 additions & 3 deletions scripts/release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

import os
from typing import List
from typing import List, Optional

import packaging.version

Expand Down Expand Up @@ -52,7 +52,7 @@ def get_commit_history() -> str:
# Out of `all_tags`, find the latest previous version so that we can collect all
# commits between that version and the new version we're about to publish.
# Note that we ignore pre-releases unless the new version is also a pre-release.
last_tag: str
last_tag: Optional[str] = None
for tag in all_tags:
if not tag.strip(): # could be blank line
continue
Expand All @@ -62,7 +62,10 @@ def get_commit_history() -> str:
if version < new_version:
last_tag = tag
break
commits = os.popen(f"git log {last_tag}..{TAG}^ --oneline --first-parent").read()
if last_tag is not None:
commits = os.popen(f"git log {last_tag}..{TAG} --oneline --first-parent").read()
else:
commits = os.popen("git log --oneline --first-parent").read()
return "## Commits\n\n" + commits


Expand Down

0 comments on commit eea3368

Please sign in to comment.