[GH-ISSUE #565] Issue: If expressions fails in act but works on Github #380

Closed
opened 2026-03-01 21:42:51 +03:00 by kerem · 8 comments
Owner

Originally created by @vegidio on GitHub (Mar 14, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/565

Act version

act version 0.2.20

Expected behaviour

act would run all steps of my workflow.

Actual behaviour

act didn't run and threw the error message "[build/build] Error in if: expression - build"

Workflow and/or repository

workflow
name: test

on:
  push:
    branches:
      - master

jobs:
  test:
    if: "!contains(github.event.head_commit.message, '[skip-ci]') && !contains(github.event.head_commit.message, '👀')"
    runs-on: ubuntu-latest

    steps:
      - name: Test
        run: echo "Test"

Steps to reproduce

  1. Save the workflow that I shared above
  2. Run act

act output

Log
DEBU[0000] Loading environment from /home/vegidio/Development/Source/js-resume/.env 
DEBU[0000] Loading secrets from /home/vegidio/Development/Source/js-resume/.secrets 
DEBU[0000] Loading workflows from '/home/vegidio/Development/Source/js-resume/.github/workflows' 
DEBU[0000] Reading workflow '/home/vegidio/Development/Source/js-resume/.github/workflows/build.yml' 
DEBU[0000] Reading workflow '/home/vegidio/Development/Source/js-resume/.github/workflows/test.yml' 
DEBU[0000] Planning job: test                           
DEBU[0000] Loading slug from git directory '/home/vegidio/Development/Source/js-resume/.git' 
DEBU[0000] Found revision: 5b2befdd9f84d2f6e5705fb94bc3e46a83c056ed 
DEBU[0000] Loading revision from git directory '/home/vegidio/Development/Source/js-resume/.git' 
DEBU[0000] Found revision: 5b2befdd9f84d2f6e5705fb94bc3e46a83c056ed 
DEBU[0000] HEAD points to '5b2befdd9f84d2f6e5705fb94bc3e46a83c056ed' 
DEBU[0000] HEAD matches refs/heads/master               
DEBU[0000] using github ref: refs/heads/master          
DEBU[0000] context env => map[ACT:true]                 
[test/test]   ❌  Error in if: expression - test
Originally created by @vegidio on GitHub (Mar 14, 2021). Original GitHub issue: https://github.com/nektos/act/issues/565 <!-- - 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). --> ## Act version <!-- Paste output of `act --version` --> ```none act version 0.2.20 ``` ## Expected behaviour <!-- Describe how whole process should go and finish --> act would run all steps of my workflow. ## Actual behaviour <!-- Describe what happened --> act didn't run and threw the error message "[build/build] ❌ Error in if: expression - build" ## Workflow and/or repository <details> <summary>workflow</summary> ```none name: test on: push: branches: - master jobs: test: if: "!contains(github.event.head_commit.message, '[skip-ci]') && !contains(github.event.head_commit.message, '👀')" runs-on: ubuntu-latest steps: - name: Test run: echo "Test" ``` </details> ## Steps to reproduce <!-- Make sure to include command you used to run `act` e.g.: 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` --> 1. Save the workflow that I shared above 2. Run `act` ## `act` output <!-- Paste output from your terminal, use `-v` or `--verbose` for richer output --> <details> <summary>Log</summary> ```none DEBU[0000] Loading environment from /home/vegidio/Development/Source/js-resume/.env DEBU[0000] Loading secrets from /home/vegidio/Development/Source/js-resume/.secrets DEBU[0000] Loading workflows from '/home/vegidio/Development/Source/js-resume/.github/workflows' DEBU[0000] Reading workflow '/home/vegidio/Development/Source/js-resume/.github/workflows/build.yml' DEBU[0000] Reading workflow '/home/vegidio/Development/Source/js-resume/.github/workflows/test.yml' DEBU[0000] Planning job: test DEBU[0000] Loading slug from git directory '/home/vegidio/Development/Source/js-resume/.git' DEBU[0000] Found revision: 5b2befdd9f84d2f6e5705fb94bc3e46a83c056ed DEBU[0000] Loading revision from git directory '/home/vegidio/Development/Source/js-resume/.git' DEBU[0000] Found revision: 5b2befdd9f84d2f6e5705fb94bc3e46a83c056ed DEBU[0000] HEAD points to '5b2befdd9f84d2f6e5705fb94bc3e46a83c056ed' DEBU[0000] HEAD matches refs/heads/master DEBU[0000] using github ref: refs/heads/master DEBU[0000] context env => map[ACT:true] [test/test] ❌ Error in if: expression - test ``` </details>
kerem 2026-03-01 21:42:51 +03:00
Author
Owner

@miigotu commented on GitHub (Mar 23, 2021):

What if you remove the double quotes?
This works for me here at least:
if: success() && steps.prepare.outputs.version == 'master' && github.event_name != 'pull_request'

<!-- gh-comment-id:804755119 --> @miigotu commented on GitHub (Mar 23, 2021): What if you remove the double quotes? This works for me here at least: `if: success() && steps.prepare.outputs.version == 'master' && github.event_name != 'pull_request'`
Author
Owner

@jsoref commented on GitHub (Apr 4, 2021):

The expression thing at least for me explicitly objects to the !. Wrapping it in ${{ ... }} makes everyone happy. I reported it as #598

<!-- gh-comment-id:812986078 --> @jsoref commented on GitHub (Apr 4, 2021): The expression thing at least for me explicitly objects to the `!`. Wrapping it in `${{ ... }}` makes everyone happy. I reported it as #598
Author
Owner

@vegidio commented on GitHub (Apr 11, 2021):

What if you remove the double quotes?

This works for me here at least:

if: success() && steps.prepare.outputs.version == 'master' && github.event_name != 'pull_request'

It doesn't work without the double quotes on Github.

<!-- gh-comment-id:817292860 --> @vegidio commented on GitHub (Apr 11, 2021): > What if you remove the double quotes? > > This works for me here at least: > > `if: success() && steps.prepare.outputs.version == 'master' && github.event_name != 'pull_request'` It doesn't work without the double quotes on Github.
Author
Owner

@github-actions[bot] commented on GitHub (May 12, 2021):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:839306692 --> @github-actions[bot] commented on GitHub (May 12, 2021): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@miigotu commented on GitHub (May 12, 2021):

What if you remove the double quotes?

This works for me here at least:

if: success() && steps.prepare.outputs.version == 'master' && github.event_name != 'pull_request'

It doesn't work without the double quotes on Github.
https://github.com/SickChill/SickChill/blob/master/.github/workflows/pythonpackage.yml#L186

<!-- gh-comment-id:840108194 --> @miigotu commented on GitHub (May 12, 2021): > > What if you remove the double quotes? > > > > This works for me here at least: > > > > `if: success() && steps.prepare.outputs.version == 'master' && github.event_name != 'pull_request'` > > It doesn't work without the double quotes on Github. https://github.com/SickChill/SickChill/blob/master/.github/workflows/pythonpackage.yml#L186
Author
Owner

@vegidio commented on GitHub (May 19, 2021):

@miigotu This is not the same example that I shared here.

Even if this example that you shared works for you, my point in this issue is to show that a workflow that works on Github with double quotes, doesn't work with act. And since act is supposed to mimic the same behaviour of Github Actions then it's a bug.

<!-- gh-comment-id:843916695 --> @vegidio commented on GitHub (May 19, 2021): @miigotu This is not the same example that I shared here. Even if this example that you shared works for you, my point in this issue is to show that a workflow that works on Github with double quotes, doesn't work with act. And since act is supposed to mimic the same behaviour of Github Actions then it's a bug.
Author
Owner

@miigotu commented on GitHub (May 19, 2021):

I was replying specifically to that comment, correcting that GitHub does work without the quotes. If you provide inaccurate information, new bugs could be introduced.

<!-- gh-comment-id:844157747 --> @miigotu commented on GitHub (May 19, 2021): I was replying specifically to that comment, correcting that GitHub does work without the quotes. If you provide inaccurate information, new bugs could be introduced.
Author
Owner

@github-actions[bot] commented on GitHub (Jun 19, 2021):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:864325396 --> @github-actions[bot] commented on GitHub (Jun 19, 2021): Issue is stale and will be closed in 14 days unless there is new activity
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#380
No description provided.