diff --git a/.github/workflows/nvm-install-test.yml b/.github/workflows/nvm-install-test.yml index fd82d2b7c2..856e2f9a1e 100644 --- a/.github/workflows/nvm-install-test.yml +++ b/.github/workflows/nvm-install-test.yml @@ -20,9 +20,12 @@ jobs: with: fetch-depth: 0 - id: matrix + env: + EVENT_NAME: ${{ github.event_name }} + INPUT_REF: ${{ github.event.inputs.ref }} run: | - if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ github.event.inputs.ref }}" ]; then - echo "matrix=\"[\"${{ github.event.inputs.ref }}\"]\"" >> $GITHUB_OUTPUT + if [ "$EVENT_NAME" == "workflow_dispatch" ] && [ -n "$INPUT_REF" ]; then + echo "matrix=\"[\"$INPUT_REF\"]\"" >> $GITHUB_OUTPUT else TAGS="$((echo "HEAD" && git tag --sort=-v:refname --merged HEAD --format='%(refname:strip=2) %(creatordate:short)' | grep '^v' | while read tag date; do if [ "$(uname)" == "Darwin" ]; then @@ -57,14 +60,16 @@ jobs: steps: - uses: actions/checkout@v4 - name: resolve HEAD to sha + env: + MATRIX_REF: ${{ matrix.ref }} run: | - if [ '${{ matrix.ref }}' = 'HEAD' ]; then + if [ "$MATRIX_REF" = 'HEAD' ]; then REF="$(git rev-parse HEAD)" else - REF="${{ matrix.ref }}" + REF="$MATRIX_REF" fi echo "resolved ref: ${REF}" - echo "ref="$REF"" >> $GITHUB_ENV + echo "ref=$REF" >> $GITHUB_ENV - run: echo $- # which options are set - run: echo node > .nvmrc if: ${{ matrix.has-nvmrc == 'nvmrc' }} @@ -80,18 +85,22 @@ jobs: . $NVM_DIR/nvm.sh && nvm --version - name: nvm install in 1 shell level, ${{ matrix.has-nvmrc }} if: ${{ matrix.shell-level == '1 shlvl' }} + env: + HAS_NVMRC: ${{ matrix.has-nvmrc }} run: | set -ex . $NVM_DIR/nvm.sh echo nvm.sh sourced nvm --version - if [ '${{ matrix.has-nvmrc }}' == 'nvmrc' ]; then + if [ "$HAS_NVMRC" == 'nvmrc' ]; then nvm install fi - name: nvm install in 2 shell levels, ${{ matrix.has-nvmrc }} if: ${{ matrix.shell-level == '2 shlvls' }} + env: + HAS_NVMRC: ${{ matrix.has-nvmrc }} run: | - if [ '${{ matrix.has-nvmrc }}' == 'nvmrc' ]; then + if [ "$HAS_NVMRC" == 'nvmrc' ]; then bash -c "set -ex && . $NVM_DIR/nvm.sh && echo nvm.sh sourced && nvm --version && nvm install" else bash -c "set -ex && . $NVM_DIR/nvm.sh && echo nvm.sh sourced && nvm --version"