Skip to content

Test GHA "if" expressions (actions/runner#1173) #11

Test GHA "if" expressions (actions/runner#1173)

Test GHA "if" expressions (actions/runner#1173) #11

Workflow file for this run

# See https://github.com/actions/runner/issues/1173
name: 'Test GHA "if" expressions (actions/runner#1173)'
on:
workflow_dispatch:
inputs:
empty:
description: 'Empty string'
default: ''
nonempty:
description: 'Non-empty string'
default: 'nonempty'
env:
# Escaped for use in step names; h/t https://github.com/orgs/community/discussions/26621#discussioncomment-3252557
L: ${{ '${{' }}
R: '}}'
jobs:
test-empty:
name: 'Empty-string "if"s: ✅'
runs-on: ubuntu-latest
steps:
- name: 'if: inputs.empty'
if: inputs.empty
run: echo
- name: 'if: ${{ env.L }} inputs.empty ${{ env.R }}'
if: ${{ inputs.empty }}
run: echo
- name: 'if: inputs.empty != '''''
if: inputs.empty != ''
run: echo
- name: 'if: ${{ env.L }} inputs.empty != '''' ${{ env.R }}'
if: ${{ inputs.empty != '' }}
run: echo
- name: 'if: inputs.empty == ''nonempty'''
if: inputs.empty == 'nonempty'
run: echo
- name: 'if: ${{ env.L }} inputs.empty == ''nonempty'' ${{ env.R }}'
if: ${{ inputs.empty == 'nonempty' }}
run: echo
- name: 'if: inputs.empty == '''''
if: inputs.empty == ''
run: echo
- name: 'if: ${{ env.L }} inputs.empty == '''' ${{ env.R }}'
if: ${{ inputs.empty == '' }}
run: echo
- name: 'if: inputs.empty != ''nonempty'''
if: inputs.empty != 'nonempty'
run: echo
- name: 'if: ${{ env.L }} inputs.empty != ''nonempty'' ${{ env.R }}'
if: ${{ inputs.empty != 'nonempty' }}
run: echo
test-nonempty:
name: 'Non-empty-string "if"s: ✅'
runs-on: ubuntu-latest
steps:
- name: 'if: inputs.nonempty'
if: inputs.nonempty
run: echo
- name: 'if: ${{ env.L }} inputs.nonempty ${{ env.R }}'
if: ${{ inputs.nonempty }}
run: echo
- name: 'if: inputs.nonempty != '''''
if: inputs.nonempty != ''
run: echo
- name: 'if: ${{ env.L }} inputs.nonempty != '''' ${{ env.R }}'
if: ${{ inputs.nonempty != '' }}
run: echo
- name: 'if: inputs.nonempty == ''nonempty'''
if: inputs.nonempty == 'nonempty'
run: echo
- name: 'if: ${{ env.L }} inputs.nonempty == ''nonempty'' ${{ env.R }}'
if: ${{ inputs.nonempty == 'nonempty' }}
run: echo
- name: 'if: inputs.nonempty == '''''
if: inputs.nonempty == ''
run: echo
- name: 'if: ${{ env.L }} inputs.nonempty == '''' ${{ env.R }}'
if: ${{ inputs.nonempty == '' }}
run: echo
- name: 'if: inputs.nonempty != ''nonempty'''
if: inputs.nonempty != 'nonempty'
run: echo
- name: 'if: ${{ env.L }} inputs.nonempty != ''nonempty'' ${{ env.R }}'
if: ${{ inputs.nonempty != 'nonempty' }}
run: echo
test-empty-mixed:
name: 'Mixed-expr-syntax "if"s: ‼️'
runs-on: ubuntu-latest
steps:
- name: 'if: ${{ env.L }} inputs.empty ${{ env.R }} == '''''
if: ${{ inputs.empty }} == ''
run: echo
- name: 'if: ${{ env.L }} inputs.empty ${{ env.R }} != '''''
if: ${{ inputs.empty }} != ''
run: echo
- name: 'if: ${{ env.L }} inputs.empty ${{ env.R }} == ''nonempty'''
if: ${{ inputs.empty }} == 'nonempty'
run: echo
- name: 'if: ${{ env.L }} inputs.empty ${{ env.R }} != ''nonempty'''
if: ${{ inputs.empty }} != 'nonempty'
run: echo