Migrate to Biome for linting and formatting (#107)

This commit is contained in:
Charlie Marsh 2024-09-30 02:55:24 -04:00 committed by GitHub
parent 023eb7875f
commit c11f8674f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 331 additions and 5772 deletions

View File

@ -1,4 +0,0 @@
dist/
lib/
node_modules/
jest.config.js

View File

@ -1,61 +0,0 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{ "accessibility": "no-public" }
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{ "allowExpressions": true }
],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}

View File

@ -1,3 +0,0 @@
dist/
lib/
node_modules/

View File

@ -1,4 +0,0 @@
{
"trailingComma": "all",
"proseWrap": "always"
}

31
biome.json Normal file
View File

@ -0,0 +1,31 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": ["dist", "lib", "node_modules"]
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "double",
"trailingCommas": "all"
}
}
}

18
dist/save-cache/index.js generated vendored
View File

@ -82951,7 +82951,7 @@ function saveCache() {
core.warning("Error retrieving cache key from state."); core.warning("Error retrieving cache key from state.");
return; return;
} }
else if (matchedKey === cacheKey) { if (matchedKey === cacheKey) {
core.info(`Cache hit occurred on key ${cacheKey}, not saving cache.`); core.info(`Cache hit occurred on key ${cacheKey}, not saving cache.`);
return; return;
} }
@ -83010,7 +83010,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.githubToken = exports.toolDir = exports.toolBinDir = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.version = void 0; exports.githubToken = exports.toolDir = exports.toolBinDir = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.version = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const path_1 = __importDefault(__nccwpck_require__(1017)); const node_path_1 = __importDefault(__nccwpck_require__(9411));
exports.version = core.getInput("version"); exports.version = core.getInput("version");
exports.checkSum = core.getInput("checksum"); exports.checkSum = core.getInput("checksum");
exports.enableCache = core.getInput("enable-cache") === "true"; exports.enableCache = core.getInput("enable-cache") === "true";
@ -83027,7 +83027,7 @@ function getToolBinDir() {
} }
if (process.platform === "win32") { if (process.platform === "win32") {
if (process.env.RUNNER_TEMP !== undefined) { if (process.env.RUNNER_TEMP !== undefined) {
return `${process.env.RUNNER_TEMP}${path_1.default.sep}uv-tool-bin-dir`; return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}uv-tool-bin-dir`;
} }
throw Error("Could not determine UV_TOOL_BIN_DIR. Please make sure RUNNER_TEMP is set or provide the tool-bin-dir input"); throw Error("Could not determine UV_TOOL_BIN_DIR. Please make sure RUNNER_TEMP is set or provide the tool-bin-dir input");
} }
@ -83040,7 +83040,7 @@ function getToolDir() {
} }
if (process.platform === "win32") { if (process.platform === "win32") {
if (process.env.RUNNER_TEMP !== undefined) { if (process.env.RUNNER_TEMP !== undefined) {
return `${process.env.RUNNER_TEMP}${path_1.default.sep}uv-tool-dir`; return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}uv-tool-dir`;
} }
throw Error("Could not determine UV_TOOL_DIR. Please make sure RUNNER_TEMP is set or provide the tool-dir input"); throw Error("Could not determine UV_TOOL_DIR. Please make sure RUNNER_TEMP is set or provide the tool-dir input");
} }
@ -83052,7 +83052,7 @@ function getCacheLocalPath() {
return cacheLocalPathInput; return cacheLocalPathInput;
} }
if (process.env.RUNNER_TEMP !== undefined) { if (process.env.RUNNER_TEMP !== undefined) {
return `${process.env.RUNNER_TEMP}${path_1.default.sep}setup-uv-cache`; return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}setup-uv-cache`;
} }
throw Error("Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input"); throw Error("Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input");
} }
@ -83214,6 +83214,14 @@ module.exports = require("node:events");
/***/ }), /***/ }),
/***/ 9411:
/***/ ((module) => {
"use strict";
module.exports = require("node:path");
/***/ }),
/***/ 4492: /***/ 4492:
/***/ ((module) => { /***/ ((module) => {

50
dist/setup/index.js generated vendored
View File

@ -87831,7 +87831,7 @@ const cache = __importStar(__nccwpck_require__(7799));
const glob = __importStar(__nccwpck_require__(8090)); const glob = __importStar(__nccwpck_require__(8090));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const inputs_1 = __nccwpck_require__(9378); const inputs_1 = __nccwpck_require__(9378);
const platforms_1 = __nccwpck_require__(6005); const platforms_1 = __nccwpck_require__(9945);
exports.STATE_CACHE_KEY = "cache-key"; exports.STATE_CACHE_KEY = "cache-key";
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key"; exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
const CACHE_VERSION = "1"; const CACHE_VERSION = "1";
@ -87924,8 +87924,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.validateChecksum = validateChecksum; exports.validateChecksum = validateChecksum;
exports.isknownVersion = isknownVersion; exports.isknownVersion = isknownVersion;
const fs = __importStar(__nccwpck_require__(7147)); const fs = __importStar(__nccwpck_require__(7561));
const crypto = __importStar(__nccwpck_require__(6113)); const crypto = __importStar(__nccwpck_require__(6005));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const known_checksums_1 = __nccwpck_require__(4379); const known_checksums_1 = __nccwpck_require__(4379);
function validateChecksum(checkSum, downloadPath, arch, platform, version) { function validateChecksum(checkSum, downloadPath, arch, platform, version) {
@ -87935,7 +87935,7 @@ function validateChecksum(checkSum, downloadPath, arch, platform, version) {
isValid = yield validateFileCheckSum(downloadPath, checkSum); isValid = yield validateFileCheckSum(downloadPath, checkSum);
} }
else { else {
core.debug(`Checksum not provided. Checking known checksums.`); core.debug("Checksum not provided. Checking known checksums.");
const key = `${arch}-${platform}-${version}`; const key = `${arch}-${platform}-${version}`;
if (key in known_checksums_1.KNOWN_CHECKSUMS) { if (key in known_checksums_1.KNOWN_CHECKSUMS) {
const knownChecksum = known_checksums_1.KNOWN_CHECKSUMS[`${arch}-${platform}-${version}`]; const knownChecksum = known_checksums_1.KNOWN_CHECKSUMS[`${arch}-${platform}-${version}`];
@ -89916,7 +89916,7 @@ exports.downloadLatest = downloadLatest;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const tc = __importStar(__nccwpck_require__(7784)); const tc = __importStar(__nccwpck_require__(7784));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(9411));
const checksum_1 = __nccwpck_require__(4622); const checksum_1 = __nccwpck_require__(4622);
const constants_1 = __nccwpck_require__(8593); const constants_1 = __nccwpck_require__(8593);
function downloadLatest(platform, arch, checkSum, githubToken) { function downloadLatest(platform, arch, checkSum, githubToken) {
@ -90015,7 +90015,7 @@ exports.tryGetFromToolCache = tryGetFromToolCache;
exports.downloadVersion = downloadVersion; exports.downloadVersion = downloadVersion;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const tc = __importStar(__nccwpck_require__(7784)); const tc = __importStar(__nccwpck_require__(7784));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(9411));
const constants_1 = __nccwpck_require__(8593); const constants_1 = __nccwpck_require__(8593);
const checksum_1 = __nccwpck_require__(4622); const checksum_1 = __nccwpck_require__(4622);
const github = __importStar(__nccwpck_require__(5438)); const github = __importStar(__nccwpck_require__(5438));
@ -90124,11 +90124,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(9411));
const download_version_1 = __nccwpck_require__(8841); const download_version_1 = __nccwpck_require__(8841);
const restore_cache_1 = __nccwpck_require__(1898); const restore_cache_1 = __nccwpck_require__(1898);
const download_latest_1 = __nccwpck_require__(5871); const download_latest_1 = __nccwpck_require__(5871);
const platforms_1 = __nccwpck_require__(6005); const platforms_1 = __nccwpck_require__(9945);
const inputs_1 = __nccwpck_require__(9378); const inputs_1 = __nccwpck_require__(9378);
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
@ -90277,7 +90277,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.githubToken = exports.toolDir = exports.toolBinDir = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.version = void 0; exports.githubToken = exports.toolDir = exports.toolBinDir = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.version = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const path_1 = __importDefault(__nccwpck_require__(1017)); const node_path_1 = __importDefault(__nccwpck_require__(9411));
exports.version = core.getInput("version"); exports.version = core.getInput("version");
exports.checkSum = core.getInput("checksum"); exports.checkSum = core.getInput("checksum");
exports.enableCache = core.getInput("enable-cache") === "true"; exports.enableCache = core.getInput("enable-cache") === "true";
@ -90294,7 +90294,7 @@ function getToolBinDir() {
} }
if (process.platform === "win32") { if (process.platform === "win32") {
if (process.env.RUNNER_TEMP !== undefined) { if (process.env.RUNNER_TEMP !== undefined) {
return `${process.env.RUNNER_TEMP}${path_1.default.sep}uv-tool-bin-dir`; return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}uv-tool-bin-dir`;
} }
throw Error("Could not determine UV_TOOL_BIN_DIR. Please make sure RUNNER_TEMP is set or provide the tool-bin-dir input"); throw Error("Could not determine UV_TOOL_BIN_DIR. Please make sure RUNNER_TEMP is set or provide the tool-bin-dir input");
} }
@ -90307,7 +90307,7 @@ function getToolDir() {
} }
if (process.platform === "win32") { if (process.platform === "win32") {
if (process.env.RUNNER_TEMP !== undefined) { if (process.env.RUNNER_TEMP !== undefined) {
return `${process.env.RUNNER_TEMP}${path_1.default.sep}uv-tool-dir`; return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}uv-tool-dir`;
} }
throw Error("Could not determine UV_TOOL_DIR. Please make sure RUNNER_TEMP is set or provide the tool-dir input"); throw Error("Could not determine UV_TOOL_DIR. Please make sure RUNNER_TEMP is set or provide the tool-dir input");
} }
@ -90319,7 +90319,7 @@ function getCacheLocalPath() {
return cacheLocalPathInput; return cacheLocalPathInput;
} }
if (process.env.RUNNER_TEMP !== undefined) { if (process.env.RUNNER_TEMP !== undefined) {
return `${process.env.RUNNER_TEMP}${path_1.default.sep}setup-uv-cache`; return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}setup-uv-cache`;
} }
throw Error("Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input"); throw Error("Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input");
} }
@ -90327,7 +90327,7 @@ function getCacheLocalPath() {
/***/ }), /***/ }),
/***/ 6005: /***/ 9945:
/***/ ((__unused_webpack_module, exports) => { /***/ ((__unused_webpack_module, exports) => {
"use strict"; "use strict";
@ -90473,6 +90473,14 @@ module.exports = require("net");
/***/ }), /***/ }),
/***/ 6005:
/***/ ((module) => {
"use strict";
module.exports = require("node:crypto");
/***/ }),
/***/ 5673: /***/ 5673:
/***/ ((module) => { /***/ ((module) => {
@ -90481,6 +90489,22 @@ module.exports = require("node:events");
/***/ }), /***/ }),
/***/ 7561:
/***/ ((module) => {
"use strict";
module.exports = require("node:fs");
/***/ }),
/***/ 9411:
/***/ ((module) => {
"use strict";
module.exports = require("node:path");
/***/ }),
/***/ 4492: /***/ 4492:
/***/ ((module) => { /***/ ((module) => {

22
dist/update-known-checksums/index.js generated vendored
View File

@ -32708,24 +32708,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.updateChecksums = updateChecksums; exports.updateChecksums = updateChecksums;
const fs_1 = __nccwpck_require__(7147); const node_fs_1 = __nccwpck_require__(7561);
const tc = __importStar(__nccwpck_require__(7784)); const tc = __importStar(__nccwpck_require__(7784));
function updateChecksums(filePath, downloadUrls) { function updateChecksums(filePath, downloadUrls) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
yield fs_1.promises.rm(filePath); yield node_fs_1.promises.rm(filePath);
yield fs_1.promises.appendFile(filePath, "// AUTOGENERATED_DO_NOT_EDIT\nexport const KNOWN_CHECKSUMS: {[key: string]: string} = {\n"); yield node_fs_1.promises.appendFile(filePath, "// AUTOGENERATED_DO_NOT_EDIT\nexport const KNOWN_CHECKSUMS: {[key: string]: string} = {\n");
let firstLine = true; let firstLine = true;
for (const downloadUrl of downloadUrls) { for (const downloadUrl of downloadUrls) {
const content = yield downloadAssetContent(downloadUrl); const content = yield downloadAssetContent(downloadUrl);
const checksum = content.split(" ")[0].trim(); const checksum = content.split(" ")[0].trim();
const key = getKey(downloadUrl); const key = getKey(downloadUrl);
if (!firstLine) { if (!firstLine) {
yield fs_1.promises.appendFile(filePath, ",\n"); yield node_fs_1.promises.appendFile(filePath, ",\n");
} }
yield fs_1.promises.appendFile(filePath, ` '${key}':\n '${checksum}'`); yield node_fs_1.promises.appendFile(filePath, ` '${key}':\n '${checksum}'`);
firstLine = false; firstLine = false;
} }
yield fs_1.promises.appendFile(filePath, "}\n"); yield node_fs_1.promises.appendFile(filePath, "}\n");
}); });
} }
function getKey(downloadUrl) { function getKey(downloadUrl) {
@ -32739,7 +32739,7 @@ function getKey(downloadUrl) {
function downloadAssetContent(downloadUrl) { function downloadAssetContent(downloadUrl) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const downloadPath = yield tc.downloadTool(downloadUrl); const downloadPath = yield tc.downloadTool(downloadUrl);
const content = yield fs_1.promises.readFile(downloadPath, "utf8"); const content = yield node_fs_1.promises.readFile(downloadPath, "utf8");
return content; return content;
}); });
} }
@ -32940,6 +32940,14 @@ module.exports = require("node:events");
/***/ }), /***/ }),
/***/ 7561:
/***/ ((module) => {
"use strict";
module.exports = require("node:fs");
/***/ }),
/***/ 4492: /***/ 4492:
/***/ ((module) => { /***/ ((module) => {

5859
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,9 +6,9 @@
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"format": "prettier --write .", "format": "biome format --fix",
"format-check": "prettier --check .", "format-check": "biome format",
"lint": "eslint src/**/*.ts --fix", "lint": "biome lint --fix",
"package": "ncc build -o dist/setup src/setup-uv.ts && ncc build -o dist/save-cache src/save-cache.ts && ncc build -o dist/update-known-checksums src/update-known-checksums.ts", "package": "ncc build -o dist/setup src/setup-uv.ts && ncc build -o dist/save-cache src/save-cache.ts && ncc build -o dist/update-known-checksums src/update-known-checksums.ts",
"test": "jest", "test": "jest",
"act": "act pull_request -W .github/workflows/test.yml --container-architecture linux/amd64 -s GITHUB_TOKEN=\"$(gh auth token)\"", "act": "act pull_request -W .github/workflows/test.yml --container-architecture linux/amd64 -s GITHUB_TOKEN=\"$(gh auth token)\"",
@ -19,12 +19,7 @@
"type": "git", "type": "git",
"url": "git+https://github.com/astral-sh/setup-uv.git" "url": "git+https://github.com/astral-sh/setup-uv.git"
}, },
"keywords": [ "keywords": ["actions", "python", "setup", "uv"],
"actions",
"python",
"setup",
"uv"
],
"author": "@eifinger", "author": "@eifinger",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -38,19 +33,12 @@
"@octokit/rest": "^21.0.2" "@octokit/rest": "^21.0.2"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "1.9.2",
"@types/node": "^22.7.3", "@types/node": "^22.7.3",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.18.0",
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"eslint": "^8.57.1",
"eslint-plugin-github": "^5.0.2",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0", "jest": "^29.7.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"prettier": "^3.3.3",
"ts-jest": "^29.2.5", "ts-jest": "^29.2.5",
"typescript": "^5.6.2" "typescript": "^5.6.2"
} }

View File

@ -1,9 +1,9 @@
import * as fs from "fs"; import * as fs from "node:fs";
import * as crypto from "crypto"; import * as crypto from "node:crypto";
import * as core from "@actions/core"; import * as core from "@actions/core";
import { KNOWN_CHECKSUMS } from "./known-checksums"; import { KNOWN_CHECKSUMS } from "./known-checksums";
import { Architecture, Platform } from "../../utils/platforms"; import type { Architecture, Platform } from "../../utils/platforms";
export async function validateChecksum( export async function validateChecksum(
checkSum: string | undefined, checkSum: string | undefined,
@ -16,7 +16,7 @@ export async function validateChecksum(
if (checkSum !== undefined && checkSum !== "") { if (checkSum !== undefined && checkSum !== "") {
isValid = await validateFileCheckSum(downloadPath, checkSum); isValid = await validateFileCheckSum(downloadPath, checkSum);
} else { } else {
core.debug(`Checksum not provided. Checking known checksums.`); core.debug("Checksum not provided. Checking known checksums.");
const key = `${arch}-${platform}-${version}`; const key = `${arch}-${platform}-${version}`;
if (key in KNOWN_CHECKSUMS) { if (key in KNOWN_CHECKSUMS) {
const knownChecksum = KNOWN_CHECKSUMS[`${arch}-${platform}-${version}`]; const knownChecksum = KNOWN_CHECKSUMS[`${arch}-${platform}-${version}`];

View File

@ -1,4 +1,4 @@
import { promises as fs } from "fs"; import { promises as fs } from "node:fs";
import * as tc from "@actions/tool-cache"; import * as tc from "@actions/tool-cache";
export async function updateChecksums( export async function updateChecksums(
filePath: string, filePath: string,

View File

@ -1,8 +1,8 @@
import * as core from "@actions/core"; import * as core from "@actions/core";
import * as tc from "@actions/tool-cache"; import * as tc from "@actions/tool-cache";
import * as exec from "@actions/exec"; import * as exec from "@actions/exec";
import * as path from "path"; import * as path from "node:path";
import { Architecture, Platform } from "../utils/platforms"; import type { Architecture, Platform } from "../utils/platforms";
import { validateChecksum } from "./checksum/checksum"; import { validateChecksum } from "./checksum/checksum";
import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants"; import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";

View File

@ -1,8 +1,8 @@
import * as core from "@actions/core"; import * as core from "@actions/core";
import * as tc from "@actions/tool-cache"; import * as tc from "@actions/tool-cache";
import * as path from "path"; import * as path from "node:path";
import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants"; import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
import { Architecture, Platform } from "../utils/platforms"; import type { Architecture, Platform } from "../utils/platforms";
import { validateChecksum } from "./checksum/checksum"; import { validateChecksum } from "./checksum/checksum";
import * as github from "@actions/github"; import * as github from "@actions/github";

View File

@ -26,7 +26,8 @@ async function saveCache(): Promise<void> {
if (!cacheKey) { if (!cacheKey) {
core.warning("Error retrieving cache key from state."); core.warning("Error retrieving cache key from state.");
return; return;
} else if (matchedKey === cacheKey) { }
if (matchedKey === cacheKey) {
core.info(`Cache hit occurred on key ${cacheKey}, not saving cache.`); core.info(`Cache hit occurred on key ${cacheKey}, not saving cache.`);
return; return;
} }

View File

@ -1,5 +1,5 @@
import * as core from "@actions/core"; import * as core from "@actions/core";
import * as path from "path"; import * as path from "node:path";
import { import {
downloadVersion, downloadVersion,
tryGetFromToolCache, tryGetFromToolCache,
@ -8,10 +8,10 @@ import { restoreCache } from "./cache/restore-cache";
import { downloadLatest } from "./download/download-latest"; import { downloadLatest } from "./download/download-latest";
import { import {
Architecture, type Architecture,
getArch, getArch,
getPlatform, getPlatform,
Platform, type Platform,
} from "./utils/platforms"; } from "./utils/platforms";
import { import {
cacheLocalPath, cacheLocalPath,

View File

@ -1,5 +1,5 @@
import * as core from "@actions/core"; import * as core from "@actions/core";
import path from "path"; import path from "node:path";
export const version = core.getInput("version"); export const version = core.getInput("version");
export const checkSum = core.getInput("checksum"); export const checkSum = core.getInput("checksum");