Test GHA "if" expressions (actions/runner#1173) #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |