I need to maintain a default that will be used for PRs and workflow_dispatch. Following is the pattern I'm trying to use, but I get an error when trying to access the env.var. How am I going wrong here and how else might I achieve the same result?
Error:
The workflow is not valid. .github/workflows/calling-workflow.yml (Line: 18, Col: 26): Unrecognized named-value: 'env'. Located at position 29 within expression: inputs.checkFoldersArray || env.checkFoldersArray
calling-workflow.yml
on:
pull_request:
workflow_dispatch:
inputs:
checkFoldersArray:
description: 'The working directory to run the tests in'
required: false
default: (".")
env:
checkFoldersArray: (".")
jobs:
pr-merge-checks:
uses: <owner>/<repo>/.github/workflows/called-workflow.yml
with:
checkFoldersArray: ${{ inputs.checkFoldersArray || env.checkFoldersArray }}
I believe if solved, I beleve this would represent an answer for Combine dynamic Github Workflow matrix with input values and predefined values.
One solution I've come up with is to declare the env as your default value, then have a job that can output the ${{ a || b }} value, or however you need to apply a default vs input.
In this example, you can dispatch with a false value and PRs will use the default of true.