I have a matrix like this:
strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macOS-latest] node-version:  dart-version: [stable, dev] code-version: [stable, insiders]
I would like to only run the dev-dart and insiders-vscode builds for the master branch, and have only the stable/stable versions run for other branches. I can't find a way to make these values conditional (either here, or by using exclude).
Hi @DanTup ,
Currently, GitHub Actions does not support to filter breaches for matrix jobs.
However, as a workaround, you can try to copy two workflows, one only for master branch and one for other branches, then set different branch filters on event and configure different values for the matrix parameters based on the branches.
Thanks - that would probably work, but my workflow is quite large and maintaining two of them wouldn't be ideal. Is it possible this may change in future? To do something similar on Travis, you can have a top-level `if` block:
if: tag IS blank AND ((branch = master and type = push) OR (env(ONLY_RUN_DART_VERSION) = env(ONLY_RUN_CODE_VERSION)))
And on AppVeyor you can use a `for` block to specify some combinations that only run for a certain branch:
for: - branches: only: - master environment: matrix: - ONLY_RUN_CODE_VERSION: DEV ONLY_RUN_DART_VERSION: STABLE - ONLY_RUN_CODE_VERSION: STABLE ONLY_RUN_DART_VERSION: DEV
I'm looking for something similar - I'm actually trying to only run the job if the matrix option matches a particular value - unfortunately it seems that's not an option at the job level, so I'd have to do it at the step level, which defeats the purpose