-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (82 loc) · 2.86 KB
/
subset_list.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Subset List Test
on:
workflow_dispatch:
inputs:
subset:
description: 'Space-separated list of environments to build. Leave empty to build all.'
required: false
default: ''
jobs:
check:
name: Check inputs to determine what to run
runs-on: ubuntu-latest
steps:
- id: parse_list
run: |
run_str="${{ github.event.inputs.subset }}"
if [ "$run_str" == "" ]; then echo "no_skip=true" >> $GITHUB_OUTPUT; exit 0; fi
echo "no_skip=false" >> $GITHUB_OUTPUT
IFS=', ' read -r -a arr <<< "$run_str"
JSON="["
for item in ${arr[@]}; do JSON="$JSON\"$item\","; done
if [[ $JSON == *, ]]; then JSON="${JSON%?}"; fi
JSON="$JSON]"
echo "run_list=$( echo "$JSON" )" >> $GITHUB_OUTPUT
echo $JSON
outputs:
no_skip: ${{ steps.parse_list.outputs.no_skip }}
run_list: ${{ steps.parse_list.outputs.run_list }}
one:
runs-on: ubuntu-latest
needs: [check]
if: always() && (needs.check.outputs.no_skip == 'true' || contains(fromJSON(needs.check.outputs.run_list), 'one'))
steps:
- name: Run
run: echo ran ${{ github.job }}!
run: echo ${{ contains(fromJSON(needs.check.outputs.run_list), 'one') }}
run: echo ${{ contains(fromJSON(needs.check.outputs.run_list), github.job) }}
two:
runs-on: ubuntu-latest
needs: [check,one]
if: |
always() && (needs.check.outputs.no_skip == 'true' ||
contains(fromJSON(needs.check.outputs.run_list), 'two'))
steps:
- name: Run
run: echo ran ${{ github.job }}!
three:
runs-on: ubuntu-latest
needs: [check,one]
if: always() && (needs.check.outputs.no_skip == 'true' || contains(fromJSON(needs.check.outputs.run_list), github.job))
steps:
- name: Run
run: echo ran ${{ github.job }}!
four:
runs-on: ubuntu-latest
needs: [check]
if: always() && (needs.check.outputs.no_skip == 'true' || contains(fromJSON(needs.check.outputs.run_list), github.job))
steps:
- name: Run
run: echo ran ${{ github.job }}!
five:
runs-on: ubuntu-latest
needs: [check,three]
if: always() && (needs.check.outputs.no_skip == 'true' || contains(fromJSON(needs.check.outputs.run_list), github.job))
steps:
- name: Run
run: echo ran ${{ github.job }}!
two_again:
runs-on: ubuntu-latest
needs: [check,one]
if: |
always() && (needs.check.outputs.no_skip == 'true' || contains(fromJSON(needs.check.outputs.run_list), github.job))
steps:
- name: Run
run: echo ran ${{ github.job }}!
six:
runs-on: ubuntu-latest
needs: [check,two_again]
if: ${{ always() && (needs.check.outputs.no_skip == 'true' || contains(fromJSON(needs.check.outputs.run_list), github.job)) }}
steps:
- name: Run
run: echo ran ${{ github.job }}!