Skip to content

Commit

Permalink
Add debugging logs (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
winterjung authored Mar 13, 2023
1 parent a211a1c commit d5c148c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Created by https://www.gitignore.io/api/linux,macos,windows,visualstudiocode
# Edit at https://www.gitignore.io/?templates=linux,macos,windows,visualstudiocode
.vscode

### Linux ###
*~
Expand Down
10 changes: 10 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def print_action_error(msg: str):
print(f'::error file={__name__}::{msg}')


def print_action_debug(msg: str):
print(f'::debug::{msg}')


def get_action_input(
name: str, required: bool = False, default: Optional[str] = None
) -> str:
Expand Down Expand Up @@ -51,12 +55,18 @@ def to_outputs(results: List[str]) -> Dict[str, str]:

def main():
msg = get_action_input('msg', required=True)
print_action_debug(f'msg: {msg}')
separator = get_action_input('separator', required=False, default=' ')
print_action_debug(f'separator: {separator}')
maxsplit = int(get_action_input('maxsplit', required=False, default='-1'))
print_action_debug(f'maxsplit: {maxsplit}')

results = split(msg, separator, maxsplit)
print_action_debug(f'results: {results}')
outputs = to_outputs(results)
print_action_debug(f'outputs: {outputs}')
for k, v in outputs.items():
print_action_debug(f'k: {k}, v: {v}')
set_action_output(k, v)


Expand Down

0 comments on commit d5c148c

Please sign in to comment.