How to create an array and join it?

I am doing this: https://github.com/evandrocoan/TestGithubActions/runs/535395974?check_suite_focus=true

name: CI
on: [push, pull_request]

jobs:
  tests:
    name: Test ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        include:
          - os: ubuntu-latest
            SEP: /
            PIP_WHEELS_DIR: ~/.cache/pip
            CARGO_INDEX_DIR: ~/.cargo/git
            CARGO_REGISTRY_DIR: ~/.cargo/registry

          - os: macos-latest
            SEP: /
            PIP_WHEELS_DIR: ~/Library/Caches/pip
            CARGO_INDEX_DIR: ~/.cargo/git
            CARGO_REGISTRY_DIR: ~/.cargo/registry

          - os: windows-latest
            SEP: \
            PIP_WHEELS_DIR: ~\AppData\Local\pip\Cache
            CARGO_INDEX_DIR: C:\Rust\.cargo\git
            CARGO_REGISTRY_DIR: C:\Rust\.cargo\registry

    steps:
      - uses: actions/checkout@v2

      - name: Cache pip wheels
        uses: actions/cache@v1
        with:
          path: ${{ join( [${{ matrix.PIP_WHEELS_DIR }}, big, deal], matrix.SEP ) }}
          key: ${{ runner.os }}-pip-3-

      - run: echo Print something.

      - run: echo On ubuntu-latest
        if: matrix.os == 'ubuntu-latest'

The problem is path: ${{ join( [${{ matrix.PIP_WHEELS_DIR }}, big, deal], matrix.SEP ) }} . Accordingly to the Operating System, I am joining the path using the right SEP. 

But how to create an array to strings and pass it to the join() function? With this code, I am getting:

Unexpected symbol: '['. Located at position 7 within expression: join( [${{ matrix.PIP_WHEELS_DIR

Managed to use them like this: https://github.com/evandrocoan/TestGithubActions/runs/535440013?check_suite_focus=true#step:9:2

- name: Cache pip wheels
        uses: actions/cache@v1
        with:
          path: ${{ matrix.PIP_WHEELS_DIR }}${{ matrix.SEP }}var${{ matrix.SEP }}home
          key: ${{ runner.os }}-pip-4-

@evandrocoan ,

Thanks fot your feednack.

I have reported this ticket to the appropriate engineering team for further investigation and evaluation. If they have any progress, I will notify you in time, and sometimes the appropriate engineers may directly reply you here.

1 Like

Boolean, null, number, string are the only supported literal types. The expression syntax does not support array literals or object literals.