Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference between github and act when running contains(needs.*.result, 'success') #2591

Open
m1r4c opened this issue Dec 29, 2024 · 0 comments
Labels
kind/bug Something isn't working

Comments

@m1r4c
Copy link

m1r4c commented Dec 29, 2024

Bug report info

act version:            0.2.70
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 24
Docker host:            unix:///run/user/1002//podman/podman.sock
Sockets found:
        /var/run/docker.sock(broken)
        $XDG_RUNTIME_DIR/podman/podman.sock
Config files:
        /home/xx/.config/act/actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.21.13
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -s -w -X main.version=0.2.70 -X main.commit=9c7f103bb39f11430f58c1a68d5629a42e6d56a1 -X main.date=2024-12-01T02:37:38Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         9c7f103bb39f11430f58c1a68d5629a42e6d56a1
                vcs.time:             2024-12-01T02:37:19Z
                vcs.modified:         false
Docker Engine:
        Engine version:        4.9.3
        Engine runtime:        crun
        Cgroup version:        1
        Cgroup driver:         cgroupfs
        Storage driver:        overlay
        Registry URI:
        OS:                    ubuntu
        OS type:               linux
        OS version:            24.04
        OS arch:               amd64
        OS kernel:             5.15.167.4-microsoft-standard-WSL2
        OS CPU:                24
        OS memory:             32037 MB
        Security options:
                name=seccomp,profile=default
                name=rootless

Command used with act

act

Describe issue

Hello and thank you for this awesome tool!

Wanted to report an issue I am having where there seems to be a difference between how github actions handles it and this tool.

I am trying to specify a job which is dependant on two other jobs where the other jobs are reporting success but the job which is dependant on the other two jobs is finishing with an error when running it with act.

The relevant part is there I am checking for ${{ contains(needs.*.result, 'success') }} which on github actions reports true:
image

but this tool (act) reports false:
image

I created a sample repository to demonstrate this: https://github.com/ldomesjo/testing-github-actions

BR
Lars

Link to GitHub repository

https://github.com/ldomesjo/testing-github-actions

Workflow content

name: learn-github-actions
run-name: ${{ github.actor }} is learning GitHub Actions
on: [push]
jobs:
  first-job:
    runs-on: ubuntu-latest
    steps:
      - run: echo meh
  second-job:
    runs-on: ubuntu-latest
    steps:
      - run: echo meh
  third-job:
    runs-on: ubuntu-latest
    needs:
      - first-job
      - second-job
    steps:
      - run: echo '${{ toJSON(needs) }}'
      - run: echo ${{ contains(needs.*.result, 'success') }}

Relevant log output

[learn-github-actions/third-job ]   ✅  Success - Main echo '{
  "first-job": {
    "outputs": null,
    "result": "success"
  },
  "second-job": {
    "outputs": null,
    "result": "success"
  }
}'
[learn-github-actions/third-job ] ⭐ Run Main echo false
[learn-github-actions/third-job ]   🐳  docker exec cmd=[bash -e /var/run/act/workflow/1] user= workdir=
| false
[learn-github-actions/third-job ]   ✅  Success - Main echo false
[learn-github-actions/third-job ] Cleaning up container for job third-job
[learn-github-actions/third-job ] 🏁  Job succeeded

Additional information

No response

@m1r4c m1r4c added the kind/bug Something isn't working label Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant