Skip to content

Commit fa13fb7

Browse files
committed
Add matrix input
1 parent 26be1d3 commit fa13fb7

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/reusable-testing.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ on:
1818
type: boolean
1919
required: false
2020
default: true
21+
matrix:
22+
description: 'Additional matrix entries to include or exclude.'
23+
type: string
24+
required: false
25+
default: '{ "include": [], "exclude": [] }'
2126

2227
# Cancels all previous workflow runs for the same branch that have not yet completed.
2328
concurrency:
@@ -34,6 +39,8 @@ jobs:
3439
steps:
3540
- name: Set matrix
3641
id: base-matrix
42+
env:
43+
ADDITIONAL_MATRIX: ${{ inputs.matrix }}
3744
run: |
3845
MATRIX=$(cat << EOF
3946
{
@@ -205,7 +212,8 @@ jobs:
205212
}
206213
EOF
207214
)
208-
echo matrix=$MATRIX >> $GITHUB_OUTPUT
215+
MERGED_MATRIX=$(echo "$MATRIX" "$ADDITIONAL_MATRIX" | jq -s '{include: (.[0].include + .[1].include | unique), exclude: (.[0].exclude + .[1].exclude | unique)}')
216+
echo matrix=$MERGED_MATRIX >> $GITHUB_OUTPUT
209217
210218
prepare-unit:
211219
name: Prepare matrix for unit tests

0 commit comments

Comments
 (0)