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 ワークフローとアクションで式を評価する.