You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I want to allow many values to be overridden using vars but still provide defaults/fallback values when the var is not set. This is possible with the "or" operator:
${{vars.optional_config || 'default value'}}
However, this currently generates a warning "Context access might be invalid: optional_config"
Describe the solution you'd like
The static analyser should detect that the || operator provides a default and not generate a warning.
Alternatively, provide a function (e.g. val_or_default(vars.optional_config, 'default value')) to make the user's intention explicit to the linter.
The text was updated successfully, but these errors were encountered:
Possibly related, what are you supposed to do if you don't have a fallback? If a value is required, to the point where the action should error if not present, is there a way to achieve this?
@christopher-caldwell Good point! Instead of val_or_default, the function can have the signature required_value(expr, [default]). Then if the variable is not set and the default argument is not supplied, the workflow fails.
Is your feature request related to a problem? Please describe.
I want to allow many values to be overridden using
vars
but still provide defaults/fallback values when the var is not set. This is possible with the "or" operator:However, this currently generates a warning "Context access might be invalid: optional_config"
Describe the solution you'd like
The static analyser should detect that the
||
operator provides a default and not generate a warning.Alternatively, provide a function (e.g.
val_or_default(vars.optional_config, 'default value')
) to make the user's intention explicit to the linter.The text was updated successfully, but these errors were encountered: