Skip to content

Support Excluding through expression #414

@acouch

Description

@acouch

Running into an issue where I'd like to excldue a matrix entry via an expression, but it flags that the return value isn't one of the matrix combos:

value "${{ (github.event_name == 'release' && 'prod') || 'dev' }}" in "exclude" does not match in matrix "envs" combinations. possible values are "dev", "staging", "prod"

image

Here is an example file:

name: Test Matrix

run-name: Deploy ${{ github.ref_name }} 

on: [push]

jobs:
  deploy-infra:
    name: Deploy Infrastructure
    runs-on: ubuntu-latest
    strategy:
      matrix:
        directory: ["database", "service"]
        envs: ['dev', 'staging', 'prod']
        exclude:
          - envs: ${{ (github.event_name == 'release' && 'prod') || 'dev' }}
    steps:
      - name: Show matrix
        run: |
          echo ${{ matrix.directory }} ${{ matrix.envs }}

Any assistance or pointers appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions