Find Related products on Amazon

Shop on Amazon

Any program can be a GitHub Actions shell

Published on: 2025-05-10 03:20:10

In GitHub Actions, you can use the shell keyword to specify the shell that runs a given run: block. This keyword is optional for workflows but mandatory for action definitions. The shell normally defaults to something sensible for your runner, e.g. bash on Linux and macOS, and pwsh on Windows. But it can also be specified, and GitHub documents that specifying it explicitly also implies some flags of their choosing: - shell : bash run : | echo "Hello, world!" Based on that, you might think that there's a fixed number of valid shell values , which GitHub tracks and adds their special flags to. But you'd be wrong! As it turns out, you can set shell to any executable on the $PATH , and GitHub will happily use it to execute the run block. If the command doesn't already take a single file as input, you need to pass it the special {0} argument, which GitHub replaces with the temporary file that it generates the template-expanded run block into. Thanks to this, we can do all kinds of curs ... Read full article.