Quote language versions in YAML examples
Code of Conduct
- [X] I have read and agree to the GitHub Docs project's 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
Hi! Where can i find the code to edit, so i can send a pr?
Or if there's no code to edit and I'm stupid, please let me know!
Че сказал?
Reopening this since some but not all examples have been addressed. Others are welcome to open PRs to partially address this issue as well!
Code of Conduct
- [x] I have read and agree to the GitHub Docs project's 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.10as2.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
#27059
Hdu #27053
I looked for articles that hadn't yet been fixed and added them to the issue summary.