Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit aca2fe9

Browse files
committed
fix(changelog): check get_metadata for existing changelog file
1 parent 5fec1d4 commit aca2fe9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎commitizen/changelog.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- [ ] hook after changelog is generated (api calls)
2626
- [ ] add support for change_type maps
2727
"""
28+
import os
2829
import re
2930
from collections import defaultdict
3031
from typing import Dict, Iterable, List, Optional
@@ -157,6 +158,14 @@ def get_metadata(filepath: str) -> Dict:
157158
unreleased_title: Optional[str] = None
158159
latest_version: Optional[str] = None
159160
latest_version_position: Optional[int] = None
161+
if not os.path.isfile(filepath):
162+
return {
163+
"unreleased_start": None,
164+
"unreleased_end": None,
165+
"latest_version": None,
166+
"latest_version_position": None,
167+
}
168+
160169
with open(filepath, "r") as changelog_file:
161170
for index, line in enumerate(changelog_file):
162171
line = line.strip().lower()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /