I have a job that calls a composite action as below:
CHANGE_ORDER:
needs:
- SETVARS
runs-on: 'windows-latest'
steps:
- name: Process CO Change Order
uses: mmctech/betech/processCO@mm365
env:
SNOWTOKEN: ${{ secrets.SNOW_TOKEN }}
with:
environment: 'dev'
action: “close”
SNpass: ${{ env.SNOWTOKEN }}
Cat betech/processCO/action.yml
---
name: executeCO
inputs:
environment:
required: true
default: "create"
type: string
action:
required: true
default: "create"
type: string
SNpass:
required: true
runs:
using: "composite"
steps:
- name: Create CO
run: |
if: ${{ inputs.action == ‘create’ }}
set-location "${{ github.workspace }}\betech\Scripts"
$SNpass="${{ inputs.SNpass }}"
Write-host ./CreateCO.ps1 -myenv "${{ inputs. environment }}" -SNpass $SNpass
shell: powershell
- name: Close CO
run: |
if: ${{ inputs.action == ‘close’ }}
set-location "${{ github.workspace }}\betech\Scripts"
$SNpass="${{ inputs.SNpass }}"
Write-host ./CloseCO.ps1 -myenv "${{ inputs. environment }}" -SNpass $SNpass
shell: powershell
My requirement is that if the action passed is ‘close’ in which case the composite action’s environment variable should not be required i.e required: false else it should be true.
How can I have a condition based input variable definition in a composite workflow.
runsections. You may include these dependencies oninputsin its README for end users.ifconditions in that action seems to be placed incorrectly. Should be aboverunand not in it. You might want to update those accordingly. Also, those single quotes look different.