Skip to content

Float 3.0 is misparsed as integer 3 in workflow YAML #849

@eregon

Description

@eregon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Service FeatureFeature scope to the pipelines service and launch app

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions