Skip to content

Commit

Permalink
revert: emoji work
Browse files Browse the repository at this point in the history
  • Loading branch information
Justintime50 committed Dec 28, 2022
1 parent 64069aa commit a97da9f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion harvey/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Config:
git_timeout = int(os.getenv('GIT_TIMEOUT', 300)) # Default is 5 minutes
pagination_limit = int(os.getenv('PAGINATION_LIMIT', 20))
deploy_on_tag = os.getenv('DEPLOY_ON_TAG', True) # Whether a tag pushed will trigger a deploy or not
use_slack = os.getenv('USE_SLACK')
use_slack = bool(os.getenv('USE_SLACK'))
webhook_secret = os.getenv('WEBHOOK_SECRET', '')
slack_bot_token = os.getenv('SLACK_BOT_TOKEN')
slack_channel = os.getenv('SLACK_CHANNEL', 'general')
Expand Down
14 changes: 3 additions & 11 deletions harvey/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,9 @@


class Message:
@property
def work_emoji(self):
return ':hammer_and_wrench:' if Config.use_slack else ''

@property
def success_emoji(self):
return ':white_check_mark:' if Config.use_slack else 'Success!'

@property
def failure_emoji(self):
return ':skull_and_crossbones:' if Config.use_slack else 'Failure!'
work_emoji = ':hammer_and_wrench:' if Config.use_slack else ''
success_emoji = ':white_check_mark:' if Config.use_slack else 'Success!'
failure_emoji = ':skull_and_crossbones:' if Config.use_slack else 'Failure!'

@staticmethod
def send_slack_message(message: str):
Expand Down
6 changes: 3 additions & 3 deletions harvey/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ def succeed_deployment(message: str, webhook: Dict[str, Any]):
def _strip_emojis_from_logs(output: str) -> str:
"""Replace the emojis for logs since they won't render properly there."""
logs_without_emoji = (
output.replace(str(Message.success_emoji), 'Success!')
.replace(str(Message.failure_emoji), 'Failure!')
.replace(str(Message.work_emoji), '')
output.replace(Message.success_emoji, 'Success!')
.replace(Message.failure_emoji, 'Failure!')
.replace(Message.work_emoji, '')
)

return logs_without_emoji
Expand Down

0 comments on commit a97da9f

Please sign in to comment.