How to create OS specific composite action

Hi… I want to create a composite action which would be common for all platforms…
I know that I can use if inside run, but I need cmd shell on Windows and bash in the rest… is it possible? Because it looks that if in the step is not accepted :-/

Thanks.

According to the documentation, there is no if key indeed: Metadata syntax for GitHub Actions - GitHub Docs

If you can’t skip steps, then you can still use the facilities of the respective shell and wrap the entire run script in an if condition that checks ${{ runner.os }}. So you either execute the entire block or you simply do nothing if the OS-requirement isn’t met.

Another way would be to use bash as shell and write the code just once. Bash is available for all runners AFAIK.