mirror of
https://github.com/astral-sh/ruff-action.git
synced 2026-05-20 07:50:13 +02:00
Default to ruff-version from pyproject.toml (#30)
Closes: #9 Changes the default behavior to: - Search for a pyproject.toml in the repo root - Search in project.dependencies and dependency-groups.dev for ruff - If none is found use latest Support for requirements.txt files can be added later
This commit is contained in:
committed by
GitHub
parent
cac2f108b2
commit
7a82f1f7e4
@@ -29,13 +29,12 @@ export async function downloadVersion(
|
||||
checkSum: string | undefined,
|
||||
githubToken: string,
|
||||
): Promise<{ version: string; cachedToolDir: string }> {
|
||||
const resolvedVersion = await resolveVersion(version, githubToken);
|
||||
const artifact = `ruff-${arch}-${platform}`;
|
||||
let extension = ".tar.gz";
|
||||
if (platform === "pc-windows-msvc") {
|
||||
extension = ".zip";
|
||||
}
|
||||
const downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/download/${resolvedVersion}/${artifact}${extension}`;
|
||||
const downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/download/${version}/${artifact}${extension}`;
|
||||
core.info(`Downloading ruff from "${downloadUrl}" ...`);
|
||||
|
||||
const downloadPath = await tc.downloadTool(
|
||||
@@ -43,13 +42,7 @@ export async function downloadVersion(
|
||||
undefined,
|
||||
githubToken,
|
||||
);
|
||||
await validateChecksum(
|
||||
checkSum,
|
||||
downloadPath,
|
||||
arch,
|
||||
platform,
|
||||
resolvedVersion,
|
||||
);
|
||||
await validateChecksum(checkSum, downloadPath, arch, platform, version);
|
||||
|
||||
let ruffDir: string;
|
||||
if (platform === "pc-windows-msvc") {
|
||||
@@ -64,10 +57,10 @@ export async function downloadVersion(
|
||||
const cachedToolDir = await tc.cacheDir(
|
||||
ruffDir,
|
||||
TOOL_CACHE_NAME,
|
||||
resolvedVersion,
|
||||
version,
|
||||
arch,
|
||||
);
|
||||
return { version: resolvedVersion, cachedToolDir };
|
||||
return { version: version, cachedToolDir };
|
||||
}
|
||||
|
||||
export async function resolveVersion(
|
||||
|
||||
Reference in New Issue
Block a user