Repository: nektos/act (language: go)

Issue:
Float formatting doesn't match actions/runner
### 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 [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
```


Discussion / hints:

Fix patch:
diff --git a/pkg/exprparser/interpreter.go b/pkg/exprparser/interpreter.go
index ff4d0a201d4..ce3aca38f96 100644
--- a/pkg/exprparser/interpreter.go
+++ b/pkg/exprparser/interpreter.go
@@ -447,7 +447,7 @@ func (impl *interperterImpl) coerceToString(value reflect.Value) reflect.Value {
 		} else if math.IsInf(value.Float(), -1) {
 			return reflect.ValueOf("-Infinity")
 		}
-		return reflect.ValueOf(fmt.Sprint(value))
+		return reflect.ValueOf(fmt.Sprintf("%.15G", value.Float()))
 
 	case reflect.Slice:
 		return reflect.ValueOf("Array")


Test patch:
diff --git a/pkg/exprparser/functions_test.go b/pkg/exprparser/functions_test.go
index 3c6392c1450..ea51a2bc8ba 100644
--- a/pkg/exprparser/functions_test.go
+++ b/pkg/exprparser/functions_test.go
@@ -230,6 +230,7 @@ func TestFunctionFormat(t *testing.T) {
 		{"format('{0', '{1}', 'World')", nil, "Unclosed brackets. The following format string is invalid: '{0'", "format-invalid-format-string"},
 		{"format('{2}', '{1}', 'World')", "", "The following format string references more arguments than were supplied: '{2}'", "format-invalid-replacement-reference"},
 		{"format('{2147483648}')", "", "The following format string is invalid: '{2147483648}'", "format-invalid-replacement-reference"},
+		{"format('{0} {1} {2} {3}', 1.0, 1.1, 1234567890.0, 12345678901234567890.0)", "1 1.1 1234567890 1.23456789012346E+19", nil, "format-floats"},
 	}
 
 	env := &EvaluationEnvironment{