feat: detect ACTIONS_RUNNER_DEBUG and enable full logging#21406
Merged
feat: detect ACTIONS_RUNNER_DEBUG and enable full logging#21406
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
March 17, 2026 15:06
View session
Contributor
There was a problem hiding this comment.
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 toACTIONS_RUNNER_DEBUG=true→DEBUG=*. - Updated logger initialization to use
initDebugEnv()instead of readingDEBUGdirectly. - Added
TestInitDebugEnvto 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) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When running in GitHub Actions with runner debug mode enabled (
ACTIONS_RUNNER_DEBUG=true), the CLI now automatically enables full debug logging — equivalent to settingDEBUG=*.If
DEBUGis already set explicitly, it takes precedence overACTIONS_RUNNER_DEBUG.Changes
pkg/logger/logger.go: ExtractedinitDebugEnv()function that checksACTIONS_RUNNER_DEBUG=trueas a fallback whenDEBUGis not set.pkg/logger/logger_test.go: AddedTestInitDebugEnvcovering all four cases (DEBUG precedence, ACTIONS_RUNNER_DEBUG=true, ACTIONS_RUNNER_DEBUG=false, neither set).Security Summary
No security vulnerabilities introduced or discovered.