What exactly does `run:` do in a github action

There is absolutely zero documentation on the use of the run parameter in a step.

Things that used to work, are now throwing command not found errors.

My assumption was that anything passed to run inside of a step is akin to running sh -c, but I get “command not found” when doing something as simple as creating a local variable.

I’ve found many popular github actions whose README’s show using things like:

SOMETHING=something/something

if [[ ${SOMETHING} == ${SOMETHINGELSE ]]; then
  SOMETHING = ${SOMETHINGELSE}
fi

However, if I do that, I get SOMETHING command not found

Can you please document how run is interpreted?

Note: Is run interpreted differently if debug logging is toggled on?

Hi @LongLiveCHIEF,

Glad to see you in Github Community Forum!

run in step will execute command-line programs using the operating system’s shell. You can choose a different shell and customize the shell used to run commands, like: bash, pwsh, powershell,cmd, custom shell…etc. Default shell is different based on the runner os type you choose.

Each run keyword represents a new process and shell in the runner environment. When you provide multi-line commands, each line runs in the same shell.

Please refer to the official doc for more detail usage:
https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsrun

run is NOT interpreted differently if debug logging is toggled on but only for more details.

Thanks.

1 Like