-
Notifications
You must be signed in to change notification settings - Fork 102
50 lines (46 loc) · 1.39 KB
/
workflow-tester95.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Test 95 # Related to SO https://stackoverflow.com/questions/78461104/how-can-i-configure-a-github-actions-strategy-matrix-to-dynamically-read-a-json
on:
workflow_dispatch:
inputs:
stsReplay:
description: 'team to pick'
required: true
default: 'real-madrid'
type: choice
options:
- 'manu'
- 'chelsea'
- 'real-madrid'
- 'fc-barcelona'
- 'bayern'
- 'ac-milan'
env:
REPLAY_MAP_JSON: |
{
"manu": ["casemiro","dalot","rashford"],
"chelsea": ["sterling","james","silva"],
"real-madrid": ["vini-jr","modric","kroos"],
"bayern": ["sane","kane","alphonso"],
"ac-milan": ["rafael-leao","giroud","pulisic"]
}
jobs:
job1:
runs-on: ubuntu-latest
outputs:
players: ${{ steps.set-matrix.outputs.values }}
steps:
- id: set-matrix
run: |
input_replay="real-madrid"
echo "input_replay: $input_replay"
values=$(echo "${REPLAY_MAP_JSON}" | jq -r --arg input_replay "$input_replay" '.[$input_replay] | map("\"\(.)\"") | join(", ")')
echo "values:[$values]"
echo "values=[$values]" >> $GITHUB_OUTPUT
job2:
needs: job1
runs-on: ubuntu-latest
strategy:
matrix:
players: ${{fromJson(needs.job1.outputs.players)}}
steps:
- run: echo "Player ${{ matrix.players}}"