question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Float 3.0 is misparsed as integer 3 in workflow YAML

See original GitHub issue

Describe the bug

3.0 in a workflow is misparsed as integer 3. Or at the very least, when it’s parsed and then later converted to a string (with ${{ matrix.ruby }}), it’s 3 and not the expected 3.0.

To Reproduce

jobs:
  test:
    strategy:
      matrix:
        os: [ ubuntu-latest ]
        ruby: [ 2.7, 3.0 ]
    name: ${{ matrix.os }} ${{ matrix.ruby }}
    runs-on: ${{ matrix.os }}
    steps:
    - uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}

Expected behavior The input log and the job name should indicate 3.0, but we see 3 instead: https://github.com/eregon/setup-ruby/runs/1503368422?check_suite_focus=true#step:3:3

Run ./
  with:
    ruby-version: 3
    bundler-cache: true
    bundler: default
    working-directory: .

This is important because ruby-version: 3.0 should pick version 3.0 but not version 3.1. Due to this bug it would pick version 3.1.

I think in the YAML specification it’s clear that floats and integers are different, so they should be kept that way too in workflow YAMLS, including when passing through ${{ matrix.ruby }}.

Using quotes [ 2.7, '3.0' ] is a workaround, but it should be unnecessary and it’s much more verbose with many versions.

Runner Version and Platform

Version of your runner? 2.274.2 OS of the machine running the runner? Applies to all

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:29
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
eregoncommented, Jan 24, 2023

Another approach to solve this: https://github.com/actions/toolkit/issues/1320 That would even work for 3.10, there is no CRuby version N.10 but nevertheless it would be a general solution to this problem, as @maxim-lobanov mentioned above.

As one can see, there are hundreds of links to this issue, all workarounds for it, it’d be great to fix it, one way or another.

2reactions
eregoncommented, Jan 30, 2022

Is there a chance this could be fixed, i.e., to actually parse 3.0 as a float, just like 3.1 is parsed as a float? Could someone from the GitHub Actions team comment if that seems reasonable to fix, or it would be impossible for compatibility to change this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found