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

Fix float formatting #2018

Merged
merged 1 commit into from Oct 13, 2023
Merged

Fix float formatting #2018

merged 1 commit into from Oct 13, 2023

Conversation

jenseng
Copy link
Contributor

@jenseng jenseng commented Sep 22, 2023

@jenseng jenseng requested a review from a team as a code owner September 22, 2023 00:45
@ChristopherHX
Copy link
Contributor

actions/runner actually also use double as json number type, see

- run: echo '${{ fromJSON('1234567.0') }}'
- run: echo '${{ fromJSON('12345674444443322222222225') }}'

log

##[group]Run echo '1234567'
echo '1234567'
shell: /usr/bin/bash -e {0}
##[endgroup]
1234567
##[group]Run echo '1.23456744444433E+25'
echo '1.23456744444433E+25'
shell: /usr/bin/bash -e {0}
##[endgroup]
1.23456744444433E+25

However it uses different rules for converting them back to string

@ChristopherHX
Copy link
Contributor

See

return reflect.ValueOf(fmt.Sprint(value))

If you tell it to format it like dotnet in actions/runner then your usecase should work too

@jenseng
Copy link
Contributor Author

jenseng commented Sep 22, 2023

Great observations and thanks for the additional context! I'll see if I can rework this PR to instead format floats the same way as actions/runner

@jenseng jenseng changed the title Fix fromJSON number handling Fix float formatting Sep 22, 2023
@jenseng
Copy link
Contributor Author

jenseng commented Sep 22, 2023

Ok, updated. Let me know if you have any additional suggestions around the tests 🙏

@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Merging #2018 (65e92b9) into master (4989f44) will increase coverage by 0.55%.
Report is 253 commits behind head on master.
The diff coverage is 60.75%.

@@            Coverage Diff             @@
##           master    #2018      +/-   ##
==========================================
+ Coverage   61.22%   61.77%   +0.55%     
==========================================
  Files          46       52       +6     
  Lines        7141     8550    +1409     
==========================================
+ Hits         4372     5282     +910     
- Misses       2462     2846     +384     
- Partials      307      422     +115     
Files Coverage Δ
pkg/common/executor.go 51.69% <100.00%> (+1.69%) ⬆️
pkg/container/docker_cli.go 82.23% <ø> (ø)
pkg/container/docker_logger.go 52.08% <ø> (ø)
pkg/runner/job_executor.go 88.48% <100.00%> (+0.79%) ⬆️
pkg/runner/step_action_local.go 93.54% <100.00%> (ø)
pkg/runner/step_action_remote.go 91.56% <100.00%> (+0.65%) ⬆️
pkg/runner/step_docker.go 93.18% <100.00%> (ø)
pkg/container/file_collector.go 39.68% <0.00%> (+2.38%) ⬆️
pkg/container/util.go 0.00% <0.00%> (ø)
pkg/container/docker_build.go 60.00% <80.00%> (+1.02%) ⬆️
... and 30 more

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@ChristopherHX ChristopherHX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this. It has enough test in my opinion.

@jenseng
Copy link
Contributor Author

jenseng commented Oct 13, 2023

@cplee need me to do anything here? seems like an issue with the merge queue 🤔

@ChristopherHX
Copy link
Contributor

press update branch and magic happens, too long but cplee didn't grant mergify workflow permission

@mergify mergify bot merged commit ace4cd4 into nektos:master Oct 13, 2023
10 checks passed
jmikedupont2 pushed a commit to meta-introspector/act that referenced this pull request Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Float formatting doesn't match actions/runner
3 participants