Skip to content

Commit 77b96c6

Browse files
Add support for python-version-file
1 parent 18e2d2f commit 77b96c6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ inputs:
55
description: 'Version of python to be installed. Reads from .python-version if unset.'
66
python-version-file:
77
description: 'Version of python to be installed'
8-
default: ".python-version"
8+
default: '.python-version'
99
cache:
1010
description: Used to specify whether caching is needed. Set to true, if you'd like to enable caching.
1111
required: true

find-exact-python-version.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ set -euo pipefail
55
specified_version="$1"
66
specified_version_file="$2"
77

8+
desired_python_version="${specified_version}"
9+
10+
if [ -f "${specified_version_file}" ]; then
11+
desired_python_version=$(cat "${specified_version_file}")
12+
fi
13+
814
# This versions map should be kept in sync with
915
# - https://www.python.org/downloads/
1016
# - https://devguide.python.org/versions/
11-
case "${specified_version}" in
17+
case "${desired_python_version}" in
1218
"3")
1319
echo "3.12.0"
1420
;;

0 commit comments

Comments
 (0)