Skip to content

conditions

conditions #13

Workflow file for this run

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"