Skip to content

Commit

Permalink
better check info
Browse files Browse the repository at this point in the history
[release:0.2]
  • Loading branch information
heitorpolidoro committed Jan 19, 2024
1 parent 90d61b8 commit 19a6e54
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/managers/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def handle_release(event: CheckSuiteRequestedEvent):
break

if not version_to_release:
event.update_check_run(title="No release command found", conclusion="success")
event.update_check_run(
title="No release command found", conclusion="success"
)
return

if is_default_branch:
Expand All @@ -43,10 +45,16 @@ def handle_release(event: CheckSuiteRequestedEvent):
repository.create_git_release(
tag=version_to_release, generate_release_notes=True
)
event.update_check_run(
title=f"{version_to_release} released ✅",
summary="",
conclusion="success"
)
else:
event.update_check_run(
title=f"Ready to release {version_to_release}",
summary="Release command found ✅",
conclusion="success"
)

# try:
Expand Down
16 changes: 15 additions & 1 deletion tests/managers/test_release.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from unittest.mock import Mock
from unittest.mock import Mock, call

from src.managers.release import handle_release

Expand Down Expand Up @@ -30,6 +30,7 @@ def test_handle_release_when_there_is_a_command(event, repository, pull_request)
event.update_check_run.assert_called_once_with(
title="Ready to release 1.2.3",
summary="Release command found ✅",
conclusion="success",
)


Expand All @@ -43,6 +44,19 @@ def test_handle_release_when_head_branch_is_the_default_branch(
repository.create_git_release.assert_called_once_with(
tag="1.2.3", generate_release_notes=True
)
event.update_check_run.assert_has_calls(
[
call(
title="Releasing 1.2.3",
summary="",
),
call(
title="1.2.3 released ✅",
summary="",
conclusion="success",
),
]
)


def test_handle_release_when_there_is_no_pull_request(event, repository):
Expand Down

0 comments on commit 19a6e54

Please sign in to comment.