feat(issues): add comments for subprocess and file ops

Added explanatory comments for steps using the Hugo CLI to generate new issues and subsequent file operations, improving code readability and maintainability. No functional changes were made.
This commit is contained in:
Kumi 2024-07-23 09:31:16 +02:00
parent 3968fd4248
commit cf25a22641
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -58,10 +58,12 @@ def create_issue(
subprocess.CalledProcessError: If the Hugo command fails
IOError: If any of the Python file operations fail
"""
# Use the Hugo CLI to create a new issue
subprocess.run(
["hugo", "new", f"weekly/issue-{issue_number}/_index.md"], check=True
)
# Read the content of the new file
with open(f"content/weekly/issue-{issue_number}/_index.md", "r") as f:
content = f.read()
@ -76,6 +78,7 @@ def create_issue(
content = "\n".join(lines)
# Overwrite the file with the new content
with open(f"content/weekly/issue-{issue_number}/_index.md", "w") as f:
f.write(content)