Skip to content

Commit

Permalink
[release:0.27.5]
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorpolidoro committed Apr 29, 2024
1 parent fa32b13 commit cf919aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion githubapp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
from githubapp.config import Config
from githubapp.event_check_run import EventCheckRun

__version__ = "0.27.4"
__version__ = "0.27.5"

__all__ = ["Config", "EventCheckRun"]
5 changes: 4 additions & 1 deletion githubapp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import os
import re
from functools import wraps
from typing import Any, Callable, NoReturn, TypeVar, Union

Expand Down Expand Up @@ -90,6 +91,8 @@ def call_if(
:param value: Tha value to compare to the config, default: bool value for the config value
:param return_on_not_call: Default value to return when the method is not called, default: None
"""
def hide_sensitive_info(info):
return re.sub( r"gh._[a-zA-Z0-9]{40}", "github-token", info)

def decorator(method: Callable) -> Callable:
"""Decorator to call a method based on the configuration"""
Expand All @@ -100,7 +103,7 @@ def wrapper(*args, **kwargs) -> Any:
config_value = Config
for name in config_name.split("."):
config_value = getattr(config_value, name)
print(f"{config_name=} {config_value=} {value=}")
print(f"{config_name=} {hide_sensitive_info(config_value)=} {value=}")
if (value == NotSet and config_value) or config_value == value:
return method(*args, **kwargs)
return return_on_not_call
Expand Down

0 comments on commit cf919aa

Please sign in to comment.