Skip to content

Commit

Permalink
9 - If re-running a job with debug on set log level to debug (#11)
Browse files Browse the repository at this point in the history
- Add check of workflow DEBUG env variable existence.
  • Loading branch information
miroslavpojer authored Aug 1, 2024
1 parent eaa3307 commit 0f9e365
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion src/filename_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}')
Expand Down

0 comments on commit 0f9e365

Please sign in to comment.