Escaping `${{ }}` in workflows

Hi, I’ve a need for literal ${{VAR}} in a workflow. I’ve tried a number approaches to escaping the dollar sign, or the braces, but nothing seems to work:

${{{{VAR}}}}
\${{VAR}}
$\{{VAR}}

This either ends up with this error:

The workflow is not valid. .github/workflows/var.yml (Line: 27, Col: 19): Unrecognized named-value: ‘VAR’ Located at position 1 within expression: VAR

Or with the braces / backslashes remaining literal in the string.

I’ve not found any documentation about how to achieve this…

There might be tricks to avoid having the dollar sign next to the braces, but depending on the concrete situation it may or may not be possible to let it evaluate to ${{VAR}} in the end.

The only generic solution I can think of is to use an expression that returns it as a string:

${{ '${{VAR}}' }}

2 Likes

Thanks @Simran-B, that worked indeed!