Skip to content

Commit b08e93b

Browse files
committed
refactor: use ::debug:: workflow command for env var logging
Convert log_env_vars() to use ::debug:: workflow commands so the environment variable values only appear in the action log when ACTIONS_STEP_DEBUG is enabled. This follows GitHub Actions best practices for diagnostic output.
1 parent b42ef33 commit b08e93b

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

‎main.py‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ def env_flag(name: str, default: str = "false") -> bool:
4040

4141

4242
def log_env_vars():
43-
"""Logs the environment variables for debugging purposes."""
44-
print(f"MESSAGE = {MESSAGE}")
45-
print(f"BRANCH = {BRANCH}")
46-
print(f"AUTHOR_NAME = {AUTHOR_NAME}")
47-
print(f"AUTHOR_EMAIL = {AUTHOR_EMAIL}")
48-
print(f"DRY_RUN = {DRY_RUN}")
49-
print(f"JOB_SUMMARY = {JOB_SUMMARY}")
50-
print(f"PR_COMMENTS = {PR_COMMENTS}")
51-
print(f"PR_TITLE = {PR_TITLE}\n")
43+
"""Logs the environment variables for debugging purposes.
44+
45+
Uses the ``::debug::`` workflow command so these only appear in the
46+
action log when ``ACTIONS_STEP_DEBUG`` is set to ``true``.
47+
"""
48+
for name in ("MESSAGE", "BRANCH", "AUTHOR_NAME", "AUTHOR_EMAIL",
49+
"DRY_RUN", "JOB_SUMMARY", "PR_COMMENTS", "PR_TITLE"):
50+
value = os.getenv(name, "false")
51+
print(f"::debug::{name}={value}")
5252

5353

5454
def is_pr_event() -> bool:

0 commit comments

Comments
 (0)