Skip to content
box

GitHub Action

Setup Shell Wrapper

v1.0.5 Latest version

Setup Shell Wrapper

box

Setup Shell Wrapper

Set up a shell wrapper script for setting the actions shell from the environment

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Setup Shell Wrapper

uses: SanderVocke/[email protected]

Learn more about this action in SanderVocke/setup-shell-wrapper

Choose a version

GitHub Action: Setup Shell Wrapper

The shell: directive in GitHub Actions does not support variables.

This action works around that by creating a shell wrapper which forwards execution to a shell set in the GitHub env variables.

The action supports Windows, MacOS and Linux, but is only tested for executing bash and sh. Other shells will probably work.

Minimal example

runs-on: ubuntu-latest
steps:
    - uses: sandervocke/setup-shell-wrapper@v1
    - name: run command in bash
      shell: wrap-shell {0}
      env:
        WRAP_SHELL: bash
      run: echo "hello world" # executes in Bash
    - name: run command in sh
      shell: wrap-shell {0}
      env:
        WRAP_SHELL: sh
      run: echo "hello world" # executes in sh