Skip to main content

Expressions

You can evaluate expressions in workflows and actions.

About expressions

You can use expressions to programmatically set environment variables in workflow files and access contexts. An expression can be any combination of literal values, references to a context, or functions. You can combine literals, context references, and functions using operators. For more information about contexts, see Contexts reference.

Expressions are commonly used with the conditional if keyword in a workflow file to determine whether a step should run. When an if conditional is true, the step will run.

특정 구문을 사용하여 GitHub에게 식을 문자열로 처리하는 대신 평가하도록 지시해야 합니다.

${{ <expression> }}

참고 항목

The exception to this rule is when you are using expressions in an if clause, where, optionally, you can usually omit ${{ and }}. For more information about if conditionals, see GitHub Actions에 대한 워크플로 구문.

경고

워크플로와 작업을 만들 때는 코드가 공격자의 신뢰할 수 없는 입력을 실행할 수 있는지 항상 고려해야 합니다. 특정 컨텍스트는 공격자가 자신의 악성 콘텐츠를 삽입할 수 있으므로 신뢰할 수 없는 입력으로 취급해야 합니다. 자세한 내용은 GitHub Actions에 대한 보안 강화을(를) 참조하세요.

Example setting an environment variable

env:
  MY_ENV_VAR: ${{ <expression> }}

Further reading

For technical reference information about expressions you can use in workflows and actions, see 워크플로 및 작업에서 식 평가.