mirror of
https://github.com/astral-sh/ruff-action.git
synced 2026-05-18 15:20:12 +02:00
Fix version-file input (#72)
The input was previously ignored Fixes: #69
This commit is contained in:
committed by
GitHub
parent
f14634c415
commit
d34edb0565
@@ -71,6 +71,7 @@ export async function resolveVersion(
|
||||
versionInput: string,
|
||||
githubToken: string,
|
||||
): Promise<string> {
|
||||
core.debug(`Resolving ${versionInput}...`);
|
||||
const version =
|
||||
versionInput === "latest"
|
||||
? await getLatestVersion(githubToken)
|
||||
@@ -84,6 +85,7 @@ export async function resolveVersion(
|
||||
if (resolvedVersion === "") {
|
||||
throw new Error(`No version found for ${version}`);
|
||||
}
|
||||
core.debug(`Resolved version: ${resolvedVersion}`);
|
||||
return resolvedVersion;
|
||||
}
|
||||
|
||||
|
||||
+8
-2
@@ -96,16 +96,22 @@ async function determineVersion(): Promise<string> {
|
||||
const versionFromPyproject = getRuffVersionFromPyproject(versionFileInput);
|
||||
if (versionFromPyproject === undefined) {
|
||||
core.warning(
|
||||
"Could not parse version from supplied pyproject.toml. Using latest version.",
|
||||
`Could not parse version from ${versionFileInput}. Using latest version.`,
|
||||
);
|
||||
return await resolveVersion("latest", githubToken);
|
||||
}
|
||||
return await resolveVersion(versionFromPyproject || "latest", githubToken);
|
||||
}
|
||||
const pyProjectPath = path.join(src, "pyproject.toml");
|
||||
if (!fs.existsSync(pyProjectPath)) {
|
||||
core.info(`Could not find ${pyProjectPath}. Using latest version.`);
|
||||
return await resolveVersion("latest", githubToken);
|
||||
}
|
||||
const versionFromPyproject = getRuffVersionFromPyproject(pyProjectPath);
|
||||
if (versionFromPyproject === undefined) {
|
||||
core.warning(
|
||||
`Could not parse version from ${pyProjectPath}. Using latest version.`,
|
||||
);
|
||||
}
|
||||
return await resolveVersion(versionFromPyproject || "latest", githubToken);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user