Skip to content

Commit

Permalink
Add get_wurst_version method to JekyllPost
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Jan 17, 2025
1 parent 3bbffc4 commit c74f03d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 3 additions & 5 deletions _scripts/announce_wurst_backport.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,18 @@ def main(wurst_version: str, mc_version: str, dry_run: bool = False):
prev_update = find_update_before(current_update.get_date(), mc_version)
if prev_update is None:
raise ValueError(f"No previous update found for Minecraft {mc_version}")
print(f"Previous update: {prev_update.path.name}")
print(f"Previous update: {prev_update.get_wurst_version()}")

# Combine changelogs
changelogs = []
update_posts = find_updates_between(prev_update.get_date(), current_update.get_date())
print(
f"Updates between {prev_update.path.name} and {wurst_version}: {[post.path.name for post in update_posts]}"
f"Updates between {prev_update.get_wurst_version()} and {wurst_version}: {[post.get_wurst_version() for post in update_posts]}"
)
for post in update_posts:
changelog = util.parse_changelog(post.content)
update_url = post.get_update_url()
new_heading = (
f"## Changes from [Wurst {post.front_matter['wurst-version']}]({update_url})\n"
)
new_heading = f"## Changes from [Wurst {post.get_wurst_version()}]({update_url})\n"

# Filter out posts with multiple "## Changelog" headings
if changelog.startswith("## Changelog\n") and changelog.count("## Changelog") == 1:
Expand Down
3 changes: 3 additions & 0 deletions _scripts/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def get_update_url(self) -> str:
def get_date(self) -> datetime:
return datetime.strptime(self.path.name[:10], "%Y-%m-%d")

def get_wurst_version(self) -> str:
return self.front_matter["wurst-version"]

def get_mc_versions(self) -> list[str]:
return self.front_matter.get("minecraft-versions", [])

Expand Down

0 comments on commit c74f03d

Please sign in to comment.