You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to debug a script: | block, and I have to modify the script with debug: true to be able to do so even though there's UI for it in shape of "[x] Enable debug logging".
Describe the solution you'd like
Make the default value of debug param
description: Whether to tell the GitHub client to log details of its requests
default: false
equivalent to default: ${{ secrets.ACTIONS_STEP_DEBUG || false }}. Not sure if this would work verbatum, but what would work best if it tries to read the secret, and if that fails or not set, then falls back to the now-default false. I tried this as a parameter to the action, and it works well.
Describe alternatives you've considered
Trying to remember to put debug: ${{ secrets.ACTIONS_STEP_DEBUG || false }} for all of my .yml files.
You can always use debug: false if you don't like the request logs from appearing when you enable debug logging, and debug: true if you want it enabled permanently.
You can always use debug: false if you don't like the request logs from appearing when you enable debug logging, and debug: true if you want it enabled permanently.
@mjpieters Is my reading correct that you meant that the default makes sense in line with the UI checkbox, and if someone wants a different 'static' behavior, they can use what you described. i.e. "You can" = "If someone wants".
Correction: RUNNER_DEBUG is either absent (empty) or set to '1', but getBooleanInput() looks for true or false (in various capitalisations), so the expression I gave is wrong. This should work better:
Activity
custom-status: debug when debugging (#1)
TWiStErRob commentedon Apr 4, 2023
@DanRigby @mjpieters now that debug actually does something, what are your thoughts on this?
mjpieters commentedon Apr 4, 2023
I kind-of like this idea, it makes sense.
You can always use
debug: falseif you don't like the request logs from appearing when you enable debug logging, anddebug: trueif you want it enabled permanently.joshmgross commentedon Apr 4, 2023
Something like this should work with the existing "Enable debug logging" option:
TWiStErRob commentedon Apr 4, 2023
@mjpieters Is my reading correct that you meant that the default makes sense in line with the UI checkbox, and if someone wants a different 'static' behavior, they can use what you described. i.e. "You can" = "If someone wants".
TWiStErRob commentedon Apr 4, 2023
@joshmgross that wouldn't allow explicit
debug: falseto always turn it off, regardless of debug flag, right?joshmgross commentedon Apr 4, 2023
Good point, we'd need to check if it's set first:
TWiStErRob commentedon Apr 4, 2023
... and that implies changing the default to
''(meaning "smart"), I guess, because GHA or core would automatically fill the value in?This looks like a viable -2+3 PR already :)
mjpieters commentedon Apr 4, 2023
core.getInput()returns a string, always, and so''is the value that you get whendebugis not set (and there is no default value set inaction.yml).TWiStErRob commentedon Apr 4, 2023
Yep, that's what I'm thinking too...
... but there's a default right now:
github-script/action.yml
Lines 15 to 17 in 8d76c9a
and we need some default (e.g.
'') because we want to keep it optional.mjpieters commentedon Apr 4, 2023
However, you can use Github Action expressions as the default in
actions.yml, sodefault: ${{ env.RUNNER_DEBUG || 'false' }}should work just fine.mjpieters commentedon Apr 4, 2023
Correction:
RUNNER_DEBUGis either absent (empty) or set to'1', butgetBooleanInput()looks fortrueorfalse(in various capitalisations), so the expression I gave is wrong. This should work better:mjpieters commentedon Apr 4, 2023
I've confirmed locally (via https://github.com/nektos/act) that the above expression works as designed.
TWiStErRob commentedon Apr 4, 2023
Does runner_debug take the secrets into account?
mjpieters commentedon Apr 5, 2023
The
ACTIONS_STEP_DEBUGsecret triggers debug mode but when triggered the runner sets theRUNNER_DEBUGenvironment variable.Testing for the environment variable is also what
core.isDebug()does.TWiStErRob commentedon Apr 5, 2023
Thanks for the PR @mjpieters, I was just about to create one :)
TWiStErRob commentedon Apr 5, 2023
Thanks for your efforts @mjpieters, it wasn't as trivial as it looked in the above conversation.