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

Float formatting doesn't match actions/runner #2017

Closed
jenseng opened this issue Sep 21, 2023 · 0 comments · Fixed by #2018
Closed

Float formatting doesn't match actions/runner #2017

jenseng opened this issue Sep 21, 2023 · 0 comments · Fixed by #2018
Labels
kind/bug Something isn't working

Comments

@jenseng
Copy link
Contributor

jenseng commented Sep 21, 2023

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).

Link to GitHub repository

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 �[36;1mecho '123456'�[0m
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 �[36;1mecho '1234567'�[0m
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 �[36;1mecho '123456'�[0m
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 �[36;1mecho '1234567'�[0m
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
@jenseng jenseng added the kind/bug Something isn't working label Sep 21, 2023
@jenseng jenseng changed the title fromJSON converts large-ish integers to floats Float formatting doesn't match actions/runner Sep 22, 2023
@mergify mergify bot closed this as completed in #2018 Oct 13, 2023
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

Successfully merging a pull request may close this issue.

1 participant