Using strategy.matrix values in the specification of actions to be used in a workflow

Hi,

Wondering if it is possible (or is planned to make it possible) to have workflows where strategy.matrix values are used in the specification of actions to be used in a workflow. For example:

name: Testing

on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        backend: [eclipse, swi-prolog]
    steps:
      - name: Install backend
        uses: logtalk-actions/setup-${{ matrix.backend }}@master
        with:
          ${{ matrix.backend }}-version: latest

I do get an error with the above code:

- Your workflow file was invalid: The pipeline is not valid. .github/workflows/testing_multiple_backends.yml (Line: 14, Col: 15): Unrecognized named-value: 'matrix'. Located at position 1 within expression: matrix.backend

But wondring if I’m missing some workaround that would allow such the functionality illustrated above.

Thanks,

Paulo

3 Likes

Hi Pmoura,

Variable in action name is not supported, please use exact action name with format ‘{org}/{repo}[/path]@ref’.

As a workaround, you can add ‘if’ expression as a filter.

Code like below:

- if: matrix.backend == 'eclipse'

uses: logtalk-actions/setup-eclipse@master

- if: matrix.backend == 'swi-prolog'

uses: logtalk-actions/setup-swi-prolog@master

Hope it helps, thanks.

1 Like