Skip to content

Commit

Permalink
[release:0.27.6]
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorpolidoro committed Apr 29, 2024
1 parent cf919aa commit ac26121
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 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.5"
__version__ = "0.27.6"

__all__ = ["Config", "EventCheckRun"]
7 changes: 5 additions & 2 deletions githubapp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ 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)
if isinstance(info, str):
return re.sub(r"gh._[a-zA-Z0-9]{40}", "github-token", info)
return info

def decorator(method: Callable) -> Callable:
"""Decorator to call a method based on the configuration"""
Expand All @@ -103,7 +106,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=} {hide_sensitive_info(config_value)=} {value=}")
print(f"{config_name=} config_value={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 ac26121

Please sign in to comment.