github actionsでpython version 3.10 を指定したつもりが3.1と認識されてエラーになる
例えば、以下のようにgithub actions用の.yamlファイルにpython-versionを記載するとエラーになる
.github/workflow/test.yaml
...
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, 3.10]
...
以下のissueによると、python-version指定時は'3.9'
などシングルクオートでかこう必要があるらしい。
3.10は数字扱いでパースされ3.1と解釈されてしまうらしい。
https://github.com/actions/setup-python/issues/160
Please pay attention that task input follow semver notation. As for the confusing error message, it is a feature of YAML parsing. When you specify input like version: 3.10 3.10 is parsed as a number and it is trimmed to 3.1 that looks like expected behavior for numbers. You should specify input with quotes to treat it as string. version: '3.10'
以下のように'3.9','3.10'
などシングルクオートでかこうことで解決
.github/workflow/test.yaml
...
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10']
...
参考