Skip to content

Commit d4d7d9d

Browse files
authored
Merge pull request #311 from splunk/release_notes_udpate
add --compare_against flag to release_notes action
2 parents cfda377 + 3c884d9 commit d4d7d9d

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

contentctl/actions/release_notes.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,11 @@ def release_notes(self, config:release_notes) -> None:
114114
#If a branch name is supplied, compare against develop
115115
if config.latest_branch not in repo.branches:
116116
raise ValueError(f"latest branch {config.latest_branch} does not exist in the repository. Make sure your branch name is correct")
117-
compare_against = "develop"
117+
if config.compare_against not in repo.branches:
118+
raise ValueError(f"compare_against branch {config.compare_against} does not exist in the repository. Make sure your branch name is correct")
119+
118120
commit1 = repo.commit(config.latest_branch)
119-
commit2 = repo.commit(compare_against)
121+
commit2 = repo.commit(config.compare_against)
120122
diff_index = commit2.diff(commit1)
121123

122124
modified_files:List[pathlib.Path] = []
@@ -189,7 +191,7 @@ def release_notes(self, config:release_notes) -> None:
189191

190192
if config.latest_branch:
191193
print(f"Generating release notes - \033[92m{config.latest_branch}\033[0m")
192-
print(f"Compared against - \033[92m{compare_against}\033[0m")
194+
print(f"Compared against - \033[92m{config.compare_against}\033[0m")
193195
print("\n## Release notes for ESCU " + config.latest_branch)
194196

195197
notes = [self.create_notes(config.path, stories_added, header="New Analytic Story"),

contentctl/objects/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -965,8 +965,9 @@ class release_notes(Config_Base):
965965
"second newest tag at runtime.")
966966
new_tag:Optional[str] = Field(None, description="Name of the tag containing new content. If it is not supplied,"
967967
" then it will be inferred as the newest tag at runtime.")
968-
latest_branch:Optional[str] = Field(None, description="Branch for which we are generating release notes")
969-
968+
latest_branch:Optional[str] = Field(None, description="Branch name for which we are generating release notes for")
969+
compare_against:Optional[str] = Field(default="develop", description="Branch name for which we are comparing the files changes against")
970+
970971
def releaseNotesFilename(self, filename:str)->pathlib.Path:
971972
#Assume that notes are written to dist/. This does not respect build_dir since that is
972973
#only a member of build

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[tool.poetry]
22
name = "contentctl"
3-
version = "4.4.0"
3+
version = "4.4.1"
4+
45
description = "Splunk Content Control Tool"
56
authors = ["STRT <[email protected]>"]
67
license = "Apache 2.0"

0 commit comments

Comments
 (0)