Skip to content

Subset List Test

Subset List Test #33

Workflow file for this run

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
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 this one!
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 this one!
three:
runs-on: ubuntu-latest
needs: [check,one]
if: ${{ always() && (needs.check.outputs.no_skip == 'true' || contains(fromJSON(needs.check.outputs.run_list), 'three')) }}
steps:
- name: Run
run: echo ran this one!
four:
runs-on: ubuntu-latest
needs: [check]
if: ${{ always() && (needs.check.outputs.no_skip == 'true' || contains(fromJSON(needs.check.outputs.run_list), 'four')) }}
steps:
- name: Run
run: echo ran this one!
five:
runs-on: ubuntu-latest
needs: [check,three]
if: ${{ always() && (needs.check.outputs.no_skip == 'true' || contains(fromJSON(needs.check.outputs.run_list), 'five')) }}
steps:
- name: Run
run: echo ran this one!
two_again:
runs-on: ubuntu-latest
needs: [check,one]
if: ${{ always() && (needs.check.outputs.no_skip == 'true' || contains(fromJSON(needs.check.outputs.run_list), 'two_again')) }}
steps:
- name: Run
run: echo ran this one!
six:
runs-on: ubuntu-latest
needs: [check,two_again]
if: ${{ always() && (needs.check.outputs.no_skip == 'true' || contains(fromJSON(needs.check.outputs.run_list), 'six')) }}
steps:
- name: Run
run: echo ran this one!