Skip to content

Document truthiness handling for expressions #23795

Closed
@jsoref

Description

@jsoref

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/learn-github-actions/expressions

What part(s) of the article would you like to see updated?

Some part of the page should explain how:

if: ${{ vars.FOO }}

works. Specifically, if vars.FOO isn't set, that's presumably treated as the equivalent of an empty something (string?).

if vars.FOO is set, it's presumably treated as a string.

Note that I'm using vars above, but the same applies for anything that would naturally be stringy (env, inputs(that are stringy), secrets, outputs,....)

Are all non-empty strings true?

Is the string "0" true?
Is the string "false" true?

There's some prose that says that when comparing two things, if they're of different types, they're converted to numbers.

But it isn't particularly clear if, if: ${{ some_expression }} is treated as if: ${{ (some_expression) == true }} which thus results in strings being converted to numbers and true being converted to a number.

Additional information

[maintainer edit]
Content plan here

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionsThis issue or pull request should be reviewed by the docs actions teamcontentThis issue or pull request belongs to the Docs Content teamhelp wantedAnyone is welcome to open a pull request to fix this issuenever-staleDo not close as stalepumpkin-spiceSpecifically tracked Hacktoberfest issue - internal purposesstaleThere is no recent activity on this issue or pull request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions