Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions content/actions/concepts/workflows-and-actions/expressions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: Expressions
intro: 'You can evaluate expressions in workflows and actions.'
versions:
fpt: '*'
ghes: '*'
ghec: '*'
type: overview
topics:
- Actions
- Workflows
---

## 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 [AUTOTITLE](/actions/learn-github-actions/contexts).

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.

{% data reusables.actions.expressions-syntax-evaluation %}

{% raw %}
`${{ <expression> }}`
{% endraw %}

> [!NOTE]
> The exception to this rule is when you are using expressions in an `if` clause, where, optionally, you can usually omit {% raw %}`${{`{% endraw %} and {% raw %}`}}`{% endraw %}. For more information about `if` conditionals, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif).

{% data reusables.actions.context-injection-warning %}

### Example setting an environment variable

{% raw %}

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

{% endraw %}

## Further reading

For technical reference information about expressions you can use in workflows and actions, see [AUTOTITLE](/actions/reference/evaluate-expressions-in-workflows-and-actions).
1 change: 1 addition & 0 deletions content/actions/concepts/workflows-and-actions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ children:
- /avoiding-duplication
- /about-custom-actions
- /contexts
- /expressions
- /about-monitoring-workflows
- /notifications-for-workflow-runs
- /about-troubleshooting-workflows
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Evaluate expressions in workflows and actions
shortTitle: Expressions
intro: You can evaluate expressions in workflows and actions.
shortTitle: Expressions reference
intro: Find information for expressions in {% data variables.product.prodname_actions %}.
versions:
fpt: '*'
ghes: '*'
Expand All @@ -12,36 +12,6 @@ redirect_from:
- /actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions
---

{% data reusables.actions.enterprise-github-hosted-runners %}

## 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 [AUTOTITLE](/actions/learn-github-actions/contexts).

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.

{% data reusables.actions.expressions-syntax-evaluation %}

{% raw %}
`${{ <expression> }}`
{% endraw %}

> [!NOTE]
> The exception to this rule is when you are using expressions in an `if` clause, where, optionally, you can usually omit {% raw %}`${{`{% endraw %} and {% raw %}`}}`{% endraw %}. For more information about `if` conditionals, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif).

{% data reusables.actions.context-injection-warning %}

### Example setting an environment variable

{% raw %}

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

{% endraw %}

## Literals

As part of an expression, you can use `boolean`, `null`, `number`, or `string` data types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The following features are currently unavailable on {% data variables.enterprise
| {% data variables.product.prodname_copilot %} Workspaces | Currently unavailable | N/A |
| {% data variables.copilot.copilot_extensions %} | Currently unavailable | [AUTOTITLE](/copilot/using-github-copilot/using-extensions-to-integrate-external-tools-with-copilot-chat) |
| {% data variables.product.prodname_copilot_short %} Metrics API | Currently unavailable | [AUTOTITLE](/rest/copilot/copilot-metrics) |
| {% data variables.copilot.copilot_coding_agent %} | Currently unavailable | [AUTOTITLE](/copilot/using-github-copilot/coding-agent/about-assigning-tasks-to-copilot) |
| {% data variables.copilot.copilot_coding_agent %} | Currently unavailable | [AUTOTITLE](/copilot/concepts/about-copilot-coding-agent) |
| Restricting {% data variables.product.prodname_actions %} policies to verified creators | Currently unavailable | [AUTOTITLE](/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#allow-enterprise-and-select-non-enterprise-actions-and-reusable-workflows) |
| Billing for premium requests in {% data variables.product.prodname_copilot_short %} | Currently unavailable | [AUTOTITLE](/copilot/managing-copilot/understanding-and-managing-copilot-usage/understanding-and-managing-requests-in-copilot) |
| {% data variables.product.prodname_github_models %} | Currently unavailable | [AUTOTITLE](/github-models/about-github-models) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ When you use {% data variables.copilot.copilot_coding_agent %}, {% data variable

On average, {% data variables.copilot.copilot_coding_agent %} uses 30-50 premium requests each time it is invoked. The exact number of premium requests will vary depending on the task’s complexity and the number of required steps. See [AUTOTITLE](/copilot/managing-copilot/managing-copilot-as-an-individual-subscriber/monitoring-usage-and-entitlements/avoiding-unexpected-copilot-costs).

For more information about {% data variables.copilot.copilot_coding_agent %}, see [AUTOTITLE](/copilot/using-github-copilot/coding-agent/about-assigning-tasks-to-copilot).
For more information about {% data variables.copilot.copilot_coding_agent %}, see [AUTOTITLE](/copilot/concepts/about-copilot-coding-agent).

### What happens if you have used up your monthly quota?

Expand Down
Loading
Loading