Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify usage of env.ENV_VAR instead of $ENV_VAR in when conditions #2922

Open
dam-ease opened this issue Jan 15, 2025 · 0 comments
Open

Clarify usage of env.ENV_VAR instead of $ENV_VAR in when conditions #2922

dam-ease opened this issue Jan 15, 2025 · 0 comments

Comments

@dam-ease
Copy link
Contributor

When using a condition within the when block of YAML script, referencing environment variables with $ENV_VAR, as done in other parts of the YAML script, results in an error:

When condition '$SHOREBIRD_ENABLED == "true"' is invalid: 'unexpected char '$' at 0
line 1'

The right approach is to use env.ENV_VAR instead of $ENV_VAR when referencing the environment variables. This distinction is not explicitly stated in the documentation. Although env.ENV_VAR is used in the example code snippet provided in the documentation, there is no clear explanation or note highlighting this requirement. https://docs.codemagic.io/yaml-running-builds/starting-builds-automatically/#using-condition-inside-when.

Updating the docs to state the requirement to use env.ENV_VAR in when conditions would give more clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant