Skip to content

feat: detect ACTIONS_RUNNER_DEBUG and enable full logging#21406

Merged
pelikhan merged 1 commit intomainfrom
copilot/detect-debug-mode-and-enable-logging
Mar 17, 2026
Merged

feat: detect ACTIONS_RUNNER_DEBUG and enable full logging#21406
pelikhan merged 1 commit intomainfrom
copilot/detect-debug-mode-and-enable-logging

Conversation

Copy link
Contributor

Copilot AI commented Mar 17, 2026

When running in GitHub Actions with runner debug mode enabled (ACTIONS_RUNNER_DEBUG=true), the CLI now automatically enables full debug logging — equivalent to setting DEBUG=*.

If DEBUG is already set explicitly, it takes precedence over ACTIONS_RUNNER_DEBUG.

Changes

  • pkg/logger/logger.go: Extracted initDebugEnv() function that checks ACTIONS_RUNNER_DEBUG=true as a fallback when DEBUG is not set.
  • pkg/logger/logger_test.go: Added TestInitDebugEnv covering all four cases (DEBUG precedence, ACTIONS_RUNNER_DEBUG=true, ACTIONS_RUNNER_DEBUG=false, neither set).

Security Summary

No security vulnerabilities introduced or discovered.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan March 17, 2026 15:06
@pelikhan pelikhan marked this pull request as ready for review March 17, 2026 15:07
Copilot AI review requested due to automatic review settings March 17, 2026 15:07
@pelikhan pelikhan merged commit 0b6fd62 into main Mar 17, 2026
80 checks passed
@pelikhan pelikhan deleted the copilot/detect-debug-mode-and-enable-logging branch March 17, 2026 15:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an ACTIONS_RUNNER_DEBUG=true fallback so the logger defaults to full debug output in GitHub Actions runner debug mode when DEBUG is not explicitly set.

Changes:

  • Extracted initDebugEnv() to resolve the effective debug pattern, falling back to ACTIONS_RUNNER_DEBUG=trueDEBUG=*.
  • Updated logger initialization to use initDebugEnv() instead of reading DEBUG directly.
  • Added TestInitDebugEnv to cover the intended precedence and fallback cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/logger/logger.go Initializes debugEnv via new initDebugEnv() with ACTIONS_RUNNER_DEBUG fallback.
pkg/logger/logger_test.go Adds table-driven unit tests for initDebugEnv() behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +58 to +63
func initDebugEnv() string {
if d := os.Getenv("DEBUG"); d != "" {
return d
}
if os.Getenv("ACTIONS_RUNNER_DEBUG") == "true" {
return "*"
Comment on lines +337 to +372
name string
debugEnvVal string
actionsRunnerDebug string
want string
}{
{
name: "DEBUG takes precedence over ACTIONS_RUNNER_DEBUG",
debugEnvVal: "cli:*",
actionsRunnerDebug: "true",
want: "cli:*",
},
{
name: "ACTIONS_RUNNER_DEBUG=true enables all loggers",
debugEnvVal: "",
actionsRunnerDebug: "true",
want: "*",
},
{
name: "ACTIONS_RUNNER_DEBUG=false does not enable loggers",
debugEnvVal: "",
actionsRunnerDebug: "false",
want: "",
},
{
name: "neither set returns empty",
debugEnvVal: "",
actionsRunnerDebug: "",
want: "",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Setenv("DEBUG", tt.debugEnvVal)
t.Setenv("ACTIONS_RUNNER_DEBUG", tt.actionsRunnerDebug)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants