act icon indicating copy to clipboard operation
act copied to clipboard

Enhancement: support for `RUNNER_DEBUG` environmental variable

Open kanadgupta opened this issue 3 years ago • 10 comments

Hello, thanks for this fantastic tool!

The way that I understand it, adding a repository secret called ACTIONS_STEP_DEBUG and setting it to true should enable step debug logging.

Per https://github.com/actions/runner/pull/253 and these docs, it appears that the RUNNER_DEBUG environmental variable is set to 1 when step debug logging is enabled, but I'm not seeing that environmental variable when running this command:

act -s ACTIONS_STEP_DEBUG=true

I haven't seen any issues or PRs related to this so I'm not sure if this is supported already. Please let me know if there's any other information I can provide. Thank you again!

kanadgupta avatar Feb 17 '22 19:02 kanadgupta

This is currently handled by --verbose flag, do we need to add it as env variable? I don't think it should be added, but we should have better log output parity with GHA runner.

catthehacker avatar Feb 24 '22 17:02 catthehacker

Just to clarify, it's not solely for my own action debugging purposes. I'm adding step debug logging support to an action and I want to test application logic that only runs if step debug logging is enabled.

You can see an example of this in GitHub's docs for @action/core, which is their package for writing JS-based actions:

if (core.isDebug()) {
  // curl -v https://github.com
} else {
  // curl https://github.com
}

kanadgupta avatar Feb 24 '22 20:02 kanadgupta

I know what you are talking about and it doesn't change what I said

catthehacker avatar Feb 24 '22 20:02 catthehacker

Got it! I personally see the value in having that env variable parity, but totally understand if this isn't something you plan on taking on. Appreciate this tool and the work you've put in regardless!

kanadgupta avatar Feb 24 '22 20:02 kanadgupta

It looks like using --verbose does not make core.isDebug() evalute to true. Am I missing something? How are we supposed to enable debugging as if ACTIONS_STEP_DEBUG was true?

devgioele avatar May 26 '22 15:05 devgioele

How are we supposed to enable debugging as if ACTIONS_STEP_DEBUG was true?

You can't, we are not the same thing as GHA runner, so naturally we don't have same feature set and log output

catthehacker avatar May 26 '22 17:05 catthehacker

Does the architecture of act fundamentally prevent this or could I make a PR that implements it?

devgioele avatar May 27 '22 09:05 devgioele

I doubt it's impossible to implement but it will need to be tested properly.

catthehacker avatar May 27 '22 10:05 catthehacker

As a workaround just set the RUNNER_DEBUG environment variable manually with --env RUNNER_DEBUG=1.

mjpieters avatar Apr 05 '23 08:04 mjpieters