fix: version resolution when only version file is present

Signed-off-by: Frost Ming <me@frostming.com>
This commit is contained in:
Frost Ming 2024-01-25 19:30:00 +08:00
parent 1a0fea8b8e
commit d4d1a77594
No known key found for this signature in database
GPG Key ID: 5BFA9CB4DDA943BF
4 changed files with 4 additions and 6 deletions

View File

@ -5,8 +5,6 @@ author: Frost Ming
inputs: inputs:
python-version: python-version:
description: 'Version range or exact version of a Python version to use, using SemVer''s version range syntax.' description: 'Version range or exact version of a Python version to use, using SemVer''s version range syntax.'
default: 3.x
required: false
python-version-file: python-version-file:
description: 'File containing the Python version to use. Example: .python-version' description: 'File containing the Python version to use. Example: .python-version'
architecture: architecture:

2
dist/setup-pdm.js vendored
View File

@ -91003,7 +91003,7 @@ function isCacheAvailable() {
} }
function resolveVersionInputFromDefaultFile() { function resolveVersionInputFromDefaultFile() {
const couples = [ const couples = [
[".python-version", getVersionInputFromPlainFile] ["pyproject.toml", getVersionInputFromTomlFile]
]; ];
for (const [versionFile, _fn] of couples) { for (const [versionFile, _fn] of couples) {
logWarning( logWarning(

View File

@ -1,6 +1,6 @@
{ {
"name": "setup-pdm", "name": "setup-pdm",
"version": "2.0.0", "version": "4.0.0",
"packageManager": "pnpm@8.14.3", "packageManager": "pnpm@8.14.3",
"description": "The GitHub Action for using pdm as the package manager", "description": "The GitHub Action for using pdm as the package manager",
"repository": { "repository": {

View File

@ -7,7 +7,7 @@ import { useCpythonVersion } from 'setup-python/src/find-python'
import { findPyPyVersion } from 'setup-python/src/find-pypy' import { findPyPyVersion } from 'setup-python/src/find-pypy'
import { import {
getVersionInputFromFile, getVersionInputFromFile,
getVersionInputFromPlainFile, getVersionInputFromTomlFile,
logWarning, logWarning,
} from 'setup-python/src/utils' } from 'setup-python/src/utils'
import { getExecOutput } from '@actions/exec' import { getExecOutput } from '@actions/exec'
@ -80,7 +80,7 @@ export function isCacheAvailable(): boolean {
function resolveVersionInputFromDefaultFile(): string[] { function resolveVersionInputFromDefaultFile(): string[] {
const couples: [string, (versionFile: string) => string[]][] = [ const couples: [string, (versionFile: string) => string[]][] = [
['.python-version', getVersionInputFromPlainFile], ['pyproject.toml', getVersionInputFromTomlFile],
] ]
for (const [versionFile, _fn] of couples) { for (const [versionFile, _fn] of couples) {
logWarning( logWarning(