[GH-ISSUE #897] Issue: Steps with if-expression failure() are ignored after a fail #532

Closed
opened 2026-03-01 21:44:14 +03:00 by kerem · 2 comments
Owner

Originally created by @cmitz on GitHub (Nov 22, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/897

System information

  • Operating System: macOS
  • Architecture: x64
  • Apple M1: no
  • Docker version: 20.10.10
  • Docker image used in act: normal
  • act version: 0.2.24

Expected behaviour

I expected the expressions failure() and always() within if: statements of steps to work even when the job has failed already

Actual behaviour

The steps are ignored

Workflow and/or repository

Example workflow
name: Test workflow

on:
  push:
    branches: 
      - main

jobs:
  deploy_notification:
    runs-on: ubuntu-latest
    steps:
      - name: Print something
        run: |
          echo "::notice title=Proceeding::Job has not failed yet"

      - name: Fail the job
        run: |
          echo "::error title=Job failed::Job failed "
          exit 1

      - name: Print something else
        if: ${{ failure() }}
        run: |
          echo "::notice title=Failed::Job has failed but this is not executed"

Steps to reproduce

act output

Just act

Log
[Test workflow/deploy_notification] 🚀  Start image=catthehacker/ubuntu:act-latest
[Test workflow/deploy_notification]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Test workflow/deploy_notification]   🐳  docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root
[Test workflow/deploy_notification] ⭐  Run Print something
[Test workflow/deploy_notification]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /Users/my.user/src/working-folder/workflow/0] user=
[Test workflow/deploy_notification]   ❓  ::notice title=Proceeding::Job has not failed yet
[Test workflow/deploy_notification]   ✅  Success - Print something
[Test workflow/deploy_notification] ⭐  Run Fail the job
[Test workflow/deploy_notification]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /Users/my.user/src/working-folder/workflow/1] user=
[Test workflow/deploy_notification]   ❗  ::error title=Job failed::Job failed
[Test workflow/deploy_notification]   ❌  Failure - Fail the job
Error: exit with `FAILURE`: 1
Originally created by @cmitz on GitHub (Nov 22, 2021). Original GitHub issue: https://github.com/nektos/act/issues/897 <!-- - Make sure you are able to reproduce it on the [latest version](https://github.com/nektos/act/releases) - Search the existing issues. - Refer to [README](https://github.com/nektos/act/blob/master/README.md). --> ## System information <!-- - Operating System: < Windows | Linux | macOS | etc... > - Architecture: < x64 (64-bit) | x86 (32-bit) | arm64 (64-bit) | arm (32-bit) | etc... > - Apple M1: < yes | no > - Docker version: < output of `docker system info -f "{{.ServerVersion}}"` > - Docker image used in `act`: < can be omitted if it's included in log > - `act` version: < output of `act --version`, if you've built `act` yourself, please provide commit hash > --> - Operating System: macOS - Architecture: x64 - Apple M1: no - Docker version: 20.10.10 - Docker image used in `act`: normal - `act` version: 0.2.24 ## Expected behaviour I expected the expressions `failure()` and `always()` within `if:` statements of steps to work even when the job has failed already ## Actual behaviour The steps are ignored ## Workflow and/or repository <!-- - Provide workflow with which we can reproduce the issue OR - Provide link to your GitHub repository that contains the workflow --> <details> <summary>Example workflow</summary> ```yaml name: Test workflow on: push: branches: - main jobs: deploy_notification: runs-on: ubuntu-latest steps: - name: Print something run: | echo "::notice title=Proceeding::Job has not failed yet" - name: Fail the job run: | echo "::error title=Job failed::Job failed " exit 1 - name: Print something else if: ${{ failure() }} run: | echo "::notice title=Failed::Job has failed but this is not executed" ``` </details> ## Steps to reproduce <!-- - Make sure to include full command with parameters you used to run `act`, example: 1. Clone example repo (https://github.com/cplee/github-actions-demo) 2. Enter cloned repo directory 3. Run `act -s SUPER_SECRET=im-a-value` --> ## `act` output <!-- - Use `act` with `-v`/`--verbose` and paste output from your terminal in code block below --> Just `act` <details> <summary>Log</summary> ```none [Test workflow/deploy_notification] 🚀 Start image=catthehacker/ubuntu:act-latest [Test workflow/deploy_notification] 🐳 docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [Test workflow/deploy_notification] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root [Test workflow/deploy_notification] ⭐ Run Print something [Test workflow/deploy_notification] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /Users/my.user/src/working-folder/workflow/0] user= [Test workflow/deploy_notification] ❓ ::notice title=Proceeding::Job has not failed yet [Test workflow/deploy_notification] ✅ Success - Print something [Test workflow/deploy_notification] ⭐ Run Fail the job [Test workflow/deploy_notification] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /Users/my.user/src/working-folder/workflow/1] user= [Test workflow/deploy_notification] ❗ ::error title=Job failed::Job failed [Test workflow/deploy_notification] ❌ Failure - Fail the job Error: exit with `FAILURE`: 1 ``` </details>
kerem 2026-03-01 21:44:14 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@KnisterPeter commented on GitHub (Nov 22, 2021):

This seems to be a duplicate of https://github.com/nektos/act/issues/442
The fix is waiting for merge https://github.com/nektos/act/pull/840

<!-- gh-comment-id:975569010 --> @KnisterPeter commented on GitHub (Nov 22, 2021): This seems to be a duplicate of https://github.com/nektos/act/issues/442 The fix is waiting for merge https://github.com/nektos/act/pull/840
Author
Owner

@cmitz commented on GitHub (Nov 22, 2021):

Whoops, sorry about that. I did not find it when searching for expression or failure. Thanks for clearing it up!

<!-- gh-comment-id:975610317 --> @cmitz commented on GitHub (Nov 22, 2021): Whoops, sorry about that. I did not find it when searching for `expression` or `failure`. Thanks for clearing it up!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#532
No description provided.