Skip to content

Commit

Permalink
main: Set module names as title
Browse files Browse the repository at this point in the history
If the length crosses 56 characters then the title breaks off to
multiple lines and becomes too verbose. So revert to the old message
to avoid that.
  • Loading branch information
bbhtt committed Jun 4, 2024
1 parent 7f99008 commit d4e615b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ def commit_changes(changes: t.List[str]) -> CommittedChanges:
log.info("Committing updates")
body: t.Optional[str]
if len(changes) > 1:
subject = "Update {} modules".format(len(changes))
module_names = set([i.split(":", 1)[0] for i in changes])
subj_string = "Update: " + ", ".join(module_names)
if len(subj_string) <= 56:
subject = subj_string
else:
subject = "Update {} modules".format(len(changes))
body = "\n".join(changes)
message = subject + "\n\n" + body
else:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async def test_full_run(self):
self.assertEqual(await main.run_with_args(args1), (2, 0, True))

commit_data = self._get_commit_data()
self.assertEqual(commit_data["subject"], "Update 2 modules")
self.assertEqual(commit_data["subject"], "Update: libXaw, xterm")
self.assertEqual(commit_data["author_name"], "Test Runner")
self.assertEqual(commit_data["author_email"], "test@localhost")
self.assertEqual(commit_data["committer_name"], "Test Runner")
Expand All @@ -95,7 +95,7 @@ async def test_git_envvars(self):
self.assertEqual(await main.run_with_args(args1), (2, 0, True))

commit_data = self._get_commit_data()
self.assertEqual(commit_data["subject"], "Update 2 modules")
self.assertEqual(commit_data["subject"], "Update: libXaw, xterm")
self.assertEqual(commit_data["author_name"], "Some Guy")
self.assertEqual(commit_data["author_email"], "someguy@localhost")
self.assertEqual(commit_data["committer_name"], "Test Runner")
Expand Down

0 comments on commit d4e615b

Please sign in to comment.