[GH-ISSUE #2017] Float formatting doesn't match actions/runner #969

Closed
opened 2026-03-01 21:47:48 +03:00 by kerem · 0 comments
Owner

Originally created by @jenseng on GitHub (Sep 21, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/2017

Bug report info

act version:            0.2.50
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 12
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
        $HOME/.docker/run/docker.sock
Config files:
        /Users/jonj/.actrc:
                -P ubuntu-latest=node:16-buster-slim
                -P ubuntu-22.04=node:16-bullseye-slim
                -P ubuntu-20.04=node:16-buster-slim
                -P ubuntu-18.04=node:16-buster-slim
Build info:
        Go version:            go1.21.0
        Module path:           command-line-arguments
        Main version:
        Main path:
        Main checksum:
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -X main.version=0.2.50
                DefaultGODEBUG:       panicnil=1
                CGO_ENABLED:          1
                CGO_CFLAGS:
                CGO_CPPFLAGS:
                CGO_CXXFLAGS:
                CGO_LDFLAGS:
                GOARCH:               arm64
                GOOS:                 darwin
Docker Engine:
        Engine version:        24.0.5
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:
        OS arch:               aarch64
        OS kernel:             5.15.49-linuxkit-pr
        OS CPU:                6
        OS memory:             7851 MB
        Security options:
                name=seccomp,profile=unconfined
                name=cgroupns

Command used with act

act -W .github/workflows/push.yml

Describe issue

When deserializing a JSON string, all numbers are floats. Because act formats floats with fewer significant digits than actions/runner, this can be problematic (e.g. it's an id and you're about to use it in an API call).

No response

Workflow content

on: push
jobs:
  act-bug:
    runs-on: ubuntu-latest
    steps:
      - run: echo '${{ 123456 }}'
      - run: echo '${{ 1234567 }}'
      - run: echo '${{ fromJSON('123456') }}'
      - run: echo '${{ fromJSON('1234567') }}'

Relevant log output

[push.yml/act-bug] ⭐ Run Main echo '123456'
[push.yml/act-bug]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir=
| 123456
[push.yml/act-bug]   ✅  Success - Main echo '123456'
[push.yml/act-bug] ⭐ Run Main echo '1234567'
[push.yml/act-bug]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1] user= workdir=
| 1234567
[push.yml/act-bug]   ✅  Success - Main echo '1234567'
[push.yml/act-bug] ⭐ Run Main echo '123456'
[push.yml/act-bug]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir=
| 123456
[push.yml/act-bug]   ✅  Success - Main echo '123456'
[push.yml/act-bug] ⭐ Run Main echo '1.234567e+06'
[push.yml/act-bug]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir=
| 1.234567e+06
[push.yml/act-bug]   ✅  Success - Main echo '1.234567e+06'
[push.yml/act-bug] 🏁  Job succeeded

Additional information

Note the 1.234567e+06 on the last step. By contrast, when running the workflow on GitHub, it formats those with enough significant digits and no trailing zero:

2023-09-21T20:58:56.3876205Z Complete job name: act-bug
2023-09-21T20:58:56.4870929Z ##[group]Run echo '123456'
2023-09-21T20:58:56.4871406Z echo '123456'
2023-09-21T20:58:56.5538650Z shell: /usr/bin/bash -e {0}
2023-09-21T20:58:56.5539040Z ##[endgroup]
2023-09-21T20:58:56.6109623Z 123456
2023-09-21T20:58:56.6306780Z ##[group]Run echo '1234567'
2023-09-21T20:58:56.6307114Z echo '1234567'
2023-09-21T20:58:56.6367106Z shell: /usr/bin/bash -e {0}
2023-09-21T20:58:56.6367419Z ##[endgroup]
2023-09-21T20:58:56.6452122Z 1234567
2023-09-21T20:58:56.6480835Z ##[group]Run echo '123456'
2023-09-21T20:58:56.6481500Z echo '123456'
2023-09-21T20:58:56.6538459Z shell: /usr/bin/bash -e {0}
2023-09-21T20:58:56.6538933Z ##[endgroup]
2023-09-21T20:58:56.6820069Z 123456
2023-09-21T20:58:56.6854603Z ##[group]Run echo '1234567'
2023-09-21T20:58:56.6855053Z echo '1234567'
2023-09-21T20:58:56.6914094Z shell: /usr/bin/bash -e {0}
2023-09-21T20:58:56.6914796Z ##[endgroup]
2023-09-21T20:58:56.6998866Z 1234567
Originally created by @jenseng on GitHub (Sep 21, 2023). Original GitHub issue: https://github.com/nektos/act/issues/2017 ### Bug report info ```plain text act version: 0.2.50 GOOS: darwin GOARCH: arm64 NumCPU: 12 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock $HOME/.docker/run/docker.sock Config files: /Users/jonj/.actrc: -P ubuntu-latest=node:16-buster-slim -P ubuntu-22.04=node:16-bullseye-slim -P ubuntu-20.04=node:16-buster-slim -P ubuntu-18.04=node:16-buster-slim Build info: Go version: go1.21.0 Module path: command-line-arguments Main version: Main path: Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -X main.version=0.2.50 DefaultGODEBUG: panicnil=1 CGO_ENABLED: 1 CGO_CFLAGS: CGO_CPPFLAGS: CGO_CXXFLAGS: CGO_LDFLAGS: GOARCH: arm64 GOOS: darwin Docker Engine: Engine version: 24.0.5 Engine runtime: runc Cgroup version: 2 Cgroup driver: cgroupfs Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Docker Desktop OS type: linux OS version: OS arch: aarch64 OS kernel: 5.15.49-linuxkit-pr OS CPU: 6 OS memory: 7851 MB Security options: name=seccomp,profile=unconfined name=cgroupns ``` ### Command used with act ```sh act -W .github/workflows/push.yml ``` ### Describe issue When deserializing a JSON string, all numbers are floats. Because act formats floats with fewer significant digits than actions/runner, this can be problematic (e.g. it's an id and you're about to use it in an API call). ### Link to GitHub repository _No response_ ### Workflow content ```yml on: push jobs: act-bug: runs-on: ubuntu-latest steps: - run: echo '${{ 123456 }}' - run: echo '${{ 1234567 }}' - run: echo '${{ fromJSON('123456') }}' - run: echo '${{ fromJSON('1234567') }}' ``` ### Relevant log output ```sh [push.yml/act-bug] ⭐ Run Main echo '123456' [push.yml/act-bug] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir= | 123456 [push.yml/act-bug] ✅ Success - Main echo '123456' [push.yml/act-bug] ⭐ Run Main echo '1234567' [push.yml/act-bug] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1] user= workdir= | 1234567 [push.yml/act-bug] ✅ Success - Main echo '1234567' [push.yml/act-bug] ⭐ Run Main echo '123456' [push.yml/act-bug] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir= | 123456 [push.yml/act-bug] ✅ Success - Main echo '123456' [push.yml/act-bug] ⭐ Run Main echo '1.234567e+06' [push.yml/act-bug] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir= | 1.234567e+06 [push.yml/act-bug] ✅ Success - Main echo '1.234567e+06' [push.yml/act-bug] 🏁 Job succeeded ``` ### Additional information Note the `1.234567e+06` on the last step. By contrast, when running the workflow on GitHub, it formats those with enough significant digits and no trailing zero: ``` 2023-09-21T20:58:56.3876205Z Complete job name: act-bug 2023-09-21T20:58:56.4870929Z ##[group]Run echo '123456' 2023-09-21T20:58:56.4871406Z echo '123456' 2023-09-21T20:58:56.5538650Z shell: /usr/bin/bash -e {0} 2023-09-21T20:58:56.5539040Z ##[endgroup] 2023-09-21T20:58:56.6109623Z 123456 2023-09-21T20:58:56.6306780Z ##[group]Run echo '1234567' 2023-09-21T20:58:56.6307114Z echo '1234567' 2023-09-21T20:58:56.6367106Z shell: /usr/bin/bash -e {0} 2023-09-21T20:58:56.6367419Z ##[endgroup] 2023-09-21T20:58:56.6452122Z 1234567 2023-09-21T20:58:56.6480835Z ##[group]Run echo '123456' 2023-09-21T20:58:56.6481500Z echo '123456' 2023-09-21T20:58:56.6538459Z shell: /usr/bin/bash -e {0} 2023-09-21T20:58:56.6538933Z ##[endgroup] 2023-09-21T20:58:56.6820069Z 123456 2023-09-21T20:58:56.6854603Z ##[group]Run echo '1234567' 2023-09-21T20:58:56.6855053Z echo '1234567' 2023-09-21T20:58:56.6914094Z shell: /usr/bin/bash -e {0} 2023-09-21T20:58:56.6914796Z ##[endgroup] 2023-09-21T20:58:56.6998866Z 1234567 ```
kerem 2026-03-01 21:47:48 +03:00
  • closed this issue
  • added the
    kind/bug
    label
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#969
No description provided.