-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (30 loc) · 1.13 KB
/
conditions.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
name: conditions
on:
workflow_dispatch:
jobs:
outputter:
runs-on: ubuntu-latest
outputs:
val-map: ${{ steps.step.outputs.val-map }}
steps:
- id: step
run: |
echo val-map=$(jq -n --arg val-one "3.0" --arg val-two "2.0" '$ARGS.named')
print:
runs-on: ubuntu-latest
needs: outputter
steps:
- env:
VALONE: ${{ fromJSON(needs.outputter.outputs.val-map).val-one }}
VALTWO: ${{ fromJSON(needs.outputter.outputs.val-map).val-two }}
run: echo "$VALONE, $VALTWO"
- name: Print JSON
env:
VALMAP: ${{ fromJSON(needs.outputter.outputs.val-map) }}
run: echo "${{ fromJSON(env.VALMAP.val-one) }}, ${{ fromJSON(env.VALMAP.val-two) }}"
- name: Conditional print less 10
if: fromJSON(needs.outputter.outputs.val-one) < 10 && fromJSON(needs.outputter.outputs.val-two) < 10
run: echo "Conditional print less 10"
- name: Conditional print greater 10
if: fromJSON(needs.outputter.outputs.val-one) > 10 && fromJSON(needs.outputter.outputs.val-two) > 10
run: echo "Conditional print greater 10"