Skip to content
Merged
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
28 changes: 8 additions & 20 deletions content/actions/learn-github-actions/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,34 +324,22 @@ steps:
if: {% raw %}${{ failure() }}{% endraw %}
```

{% ifversion fpt or ghes > 3.3 or ghae-issue-5504 or ghec %}
### Evaluate Status Explicitly
#### failure with conditions

Instead of using one of the methods above, you can evaluate the status of the job or composite action that is executing the step directly:
You can include extra conditions for a step to run after a failure, but you must still include `failure()` to override the default status check of `success()` that is automatically applied to `if` conditions that don't contain a status check function.

#### Example for workflow step
##### Example

```yaml
steps:
...
- name: The job has failed
if: {% raw %}${{ job.status == 'failure' }}{% endraw %}
- name: Failing step
id: demo
run: exit 1
- name: The demo step has failed
if: {% raw %}${{ failure() && steps.demo.conclusion == 'failure' }}{% endraw %}
```

This is the same as using `if: failure()` in a job step.

#### Example for composite action step

```yaml
steps:
...
- name: The composite action has failed
if: {% raw %}${{ github.action_status == 'failure' }}{% endraw %}
```

This is the same as using `if: failure()` in a composite action step.
{% endif %}

## Object filters

You can use the `*` syntax to apply a filter and select matching items in a collection.
Expand Down