From 0f9e36502ef0c2f1132dea67d06f294d6e32b43a Mon Sep 17 00:00:00 2001 From: miroslavpojer Date: Thu, 1 Aug 2024 09:25:10 +0200 Subject: [PATCH] 9 - If re-running a job with debug on set log level to debug (#11) - Add check of workflow DEBUG env variable existence. --- README.md | 1 + src/filename_inspector.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ddc60a..ab6f303 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ This action scans the specified `paths` for project files and checks if their fi - **Description**: Enable verbose logging to provide detailed output during the action’s execution, aiding in troubleshooting and setup. - **Required**: No - **Default**: `false` +- **Note**: If workflow run in debug mode, 'verbose-logging' is set to 'true.' ### `fail-on-violation` - **Description**: Set to true to fail the action if any convention violations are detected. Set false to continue without failure. diff --git a/src/filename_inspector.py b/src/filename_inspector.py index 9d774e4..d53b0fb 100644 --- a/src/filename_inspector.py +++ b/src/filename_inspector.py @@ -33,6 +33,8 @@ INPUT_VERBOSE_LOGGING = "INPUT_VERBOSE_LOGGING" INPUT_FAIL_ON_VIOLATION = "INPUT_FAIL_ON_VIOLATION" +RUNNER_DEBUG = "RUNNER_DEBUG" + def get_action_list_input(name: str) -> list[str]: # Note: this is cleanup when input defined by multiple lines @@ -90,7 +92,7 @@ def run(): verbose_logging = get_action_input(INPUT_VERBOSE_LOGGING) == 'true' fail_on_violation = get_action_input(INPUT_FAIL_ON_VIOLATION) == 'true' - if verbose_logging: + if os.getenv(RUNNER_DEBUG, 0) or verbose_logging: logging.getLogger().setLevel(logging.DEBUG) logging.debug(f'Name patterns: {name_patterns}')