docs icon indicating copy to clipboard operation
docs copied to clipboard

Quote language versions in YAML examples

Open skedwards88 opened this issue 3 years ago • 4 comments

Code of Conduct

What article on docs.github.com is affected?

YAML examples in https://docs.github.com/actions

What part(s) of the article would you like to see updated?

YAML treats floats like 2.10 as 2.1. This can lead to workflows using a different language version than intended. We should update the YAML examples to quote language versions to avoid this. To help users who copy-paste-modify without understanding the nuance, we should quote all language versions, even ones that would not be affected by this parsing.

For example:

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9]

should be changed to

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.6", "3.7", "3.8", "3.9"]

Then if a user copies the example but wants to include version 3.10, they can easily plug in the new value without knowing they need to add quotes.

Additional information

No response

skedwards88 avatar Jan 28 '22 21:01 skedwards88

Hi! Where can i find the code to edit, so i can send a pr?

bee-Michi avatar Jan 29 '22 07:01 bee-Michi

Or if there's no code to edit and I'm stupid, please let me know!

bee-Michi avatar Jan 29 '22 07:01 bee-Michi

Че сказал?

Moloko122 avatar Jan 29 '22 07:01 Moloko122

Reopening this since some but not all examples have been addressed. Others are welcome to open PRs to partially address this issue as well!

skedwards88 avatar Mar 11 '22 18:03 skedwards88

Code of Conduct

What article on docs.github.com is affected?

YAML examples in https://docs.github.com/actions

What part(s) of the article would you like to see updated?

YAML treats floats like 2.10 as 2.1. This can lead to workflows using a different language version than intended. We should update the YAML examples to quote language versions to avoid this. To help users who copy-paste-modify without understanding the nuance, we should quote all language versions, even ones that would not be affected by this parsing.

For example:

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9]

should be changed to

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.6", "3.7", "3.8", "3.9"]

Then if a user copies the example but wants to include version 3.10, they can easily plug in the new value without knowing they need to add quotes.

Additional information

No response

Elvira888 avatar Jul 25 '23 14:07 Elvira888

#27059

Elvira888 avatar Jul 25 '23 14:07 Elvira888

Hdu #27053

Elvira888 avatar Jul 25 '23 14:07 Elvira888

I looked for articles that hadn't yet been fixed and added them to the issue summary.

felicitymay avatar Sep 19 '23 15:09 felicitymay