From 4e3a8ef8899f7c6ea7a8b7b6a7a97b4b302aef37 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Tue, 26 Oct 2021 18:37:28 +0200 Subject: [PATCH 1/2] make the shell configurable (default to bash) --- action.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 1941c1b..a87d427 100644 --- a/action.yml +++ b/action.yml @@ -8,11 +8,28 @@ inputs: working-directory: description: "working directory" required: false + shell: + description: "shell (options: 'bash' or 'msys2 {0}')" + default: "bash" + required: false runs: using: "composite" steps: - - shell: bash + - name: create bash-or-msys2 + shell: bash + run: | + if [[ "${{ inputs.shell }}" == "msys2 {0}" ]]; then + if [[ ! -f "D:/a/_temp/setup-msys2/bash-or-msys2.cmd" ]]; then + powershell New-Item -ItemType SymbolicLink -Path "D:/a/_temp/setup-msys2/bash-or-msys2.cmd" -Target "D:/a/_temp/setup-msys2/msys2.cmd" + fi + elif [[ "${{ inputs.shell }}" == "bash" ]]; then + sudo ln -sf $(which bash) /usr/local/bin/bash-or-msys2 + else + echo "unknown shell: ${{ inputs.shell }}" + exit 1 + fi + - shell: bash-or-msys2 {0} working-directory: ${{ inputs.working-directory }} run: | status=0 From c64d0ce2dbba3b457596f6aa7fd527a58e8cb0a4 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Fri, 12 Nov 2021 11:07:15 +0400 Subject: [PATCH 2/2] use if --- action.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index a87d427..24835a4 100644 --- a/action.yml +++ b/action.yml @@ -16,18 +16,16 @@ inputs: runs: using: "composite" steps: - - name: create bash-or-msys2 + - name: create bash-or-msys2 (for bash) shell: bash + if: inputs.shell == 'bash' + run: sudo ln -sf $(which bash) /usr/local/bin/bash-or-msys2 + - name: create bash-or-msys2 (for msys2) + shell: bash + if: inputs.shell == 'msys2 {0}' run: | - if [[ "${{ inputs.shell }}" == "msys2 {0}" ]]; then - if [[ ! -f "D:/a/_temp/setup-msys2/bash-or-msys2.cmd" ]]; then - powershell New-Item -ItemType SymbolicLink -Path "D:/a/_temp/setup-msys2/bash-or-msys2.cmd" -Target "D:/a/_temp/setup-msys2/msys2.cmd" - fi - elif [[ "${{ inputs.shell }}" == "bash" ]]; then - sudo ln -sf $(which bash) /usr/local/bin/bash-or-msys2 - else - echo "unknown shell: ${{ inputs.shell }}" - exit 1 + if [[ ! -f "D:/a/_temp/setup-msys2/bash-or-msys2.cmd" ]]; then + powershell New-Item -ItemType SymbolicLink -Path "D:/a/_temp/setup-msys2/bash-or-msys2.cmd" -Target "D:/a/_temp/setup-msys2/msys2.cmd" fi - shell: bash-or-msys2 {0} working-directory: ${{ inputs.working-directory }}