In a small test program (below):
name: run SS_Simple1_Manual.py
on:
workflow_dispatch:
inputs:
param1:
description: "First parameter"
required: true
type: string
param2:
description: "Second parameter"
required: true
type: string
param3:
description: "Third parameter"
required: true
type: string
param4:
description: "Fourth parameter"
required: true
type: string
jobs:
main-thread:
if: ${{inputs.param4}} == 'NOSKIP'
runs-on: windows-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.7' # install the Python version needed
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: execute Python script
run: python SS_Simple1.py "${{inputs.param1}}" "${{inputs.param2}}" "${{inputs.param3}}" "${{inputs.param4}}"
I expect to only do main-thread if the value of parameter is NOSKIP. However ... though the YAML is valid, I'm getting the Python executed.
python SS_Simple1.py "Hello" "There" "Bob" "Hope" shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'" env: pythonLocation: C:\hostedtoolcache\windows\Python\3.7.9\x64 PKG_CONFIG_PATH: C:\hostedtoolcache\windows\Python\3.7.9\x64/lib/pkgconfig Python_ROOT_DIR: C:\hostedtoolcache\windows\Python\3.7.9\x64 Python2_ROOT_DIR: C:\hostedtoolcache\windows\Python\3.7.9\x64 Python3_ROOT_DIR: C:\hostedtoolcache\windows\Python\3.7.9\x64
['SS_Simple1.py', 'Hello', 'There', 'Bob', 'Hope']
I've tried a few comparisons ... haven't got there yet. Can anyone help me out?
I've tried booleans: == and eq. I've also tried a few versions of the 'param4' appearance, all rejected by the YAML interpreter
After multiple tests, I got the answer. Even though the parameter variable is referred to as ${{inputs.param4}} in the Python run string, it's only inputs.param4 in the 'if' statement. Full logic below in case it helps someone else...