diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f56912fd0d..c8a12e7466 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,6 +11,9 @@ jobs: build: # make sure build/ci work properly runs-on: ubuntu-latest steps: + - uses: actions/setup-node@v4 + with: + node-version: 24.x - if: ${{ !(github.event_name == 'pull_request' && (github.event.pull_request.user.id == 49699333 || contains(github.event.pull_request.labels.*.name, 'dependencies'))) }} uses: actions/checkout@v5 - if: github.event_name == 'pull_request' && (github.event.pull_request.user.id == 49699333 || contains(github.event.pull_request.labels.*.name, 'dependencies')) @@ -62,6 +65,9 @@ jobs: pull-requests: read steps: - uses: actions/checkout@v5 + - uses: actions/setup-node@v4 + with: + node-version: 24.x - uses: actions/setup-go@v6 with: go-version: oldstable @@ -91,6 +97,9 @@ jobs: pull-requests: read steps: - uses: actions/checkout@v5 + - uses: actions/setup-node@v4 + with: + node-version: 24.x - uses: actions/setup-go@v6 with: go-version: oldstable @@ -118,6 +127,9 @@ jobs: contents: read steps: - uses: actions/checkout@v5 + - uses: actions/setup-node@v4 + with: + node-version: 24.x - uses: actions/setup-go@v6 with: go-version: oldstable diff --git a/action.yml b/action.yml index 5f6b95071f..4922368fc6 100644 --- a/action.yml +++ b/action.yml @@ -55,7 +55,7 @@ inputs: default: '7' required: false runs: - using: "node20" + using: "node24" main: "dist/run/index.js" post: "dist/post_run/index.js" branding: diff --git a/dist/post_run/index.js b/dist/post_run/index.js index 63d717d350..f0310c7c76 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -48,6 +48,7 @@ const cacheTwirpClient = __importStar(__nccwpck_require__(6819)); const config_1 = __nccwpck_require__(7606); const tar_1 = __nccwpck_require__(5321); const constants_1 = __nccwpck_require__(8287); +const http_client_1 = __nccwpck_require__(4844); class ValidationError extends Error { constructor(message) { super(message); @@ -84,7 +85,17 @@ function checkKey(key) { * @returns boolean return true if Actions cache service feature is available, otherwise false */ function isFeatureAvailable() { - return !!process.env['ACTIONS_CACHE_URL']; + const cacheServiceVersion = (0, config_1.getCacheServiceVersion)(); + // Check availability based on cache service version + switch (cacheServiceVersion) { + case 'v2': + // For v2, we need ACTIONS_RESULTS_URL + return !!process.env['ACTIONS_RESULTS_URL']; + case 'v1': + default: + // For v1, we only need ACTIONS_CACHE_URL + return !!process.env['ACTIONS_CACHE_URL']; + } } exports.isFeatureAvailable = isFeatureAvailable; /** @@ -169,8 +180,16 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr throw error; } else { - // Supress all non-validation cache related errors because caching should be optional - core.warning(`Failed to restore: ${error.message}`); + // warn on cache restore failure and continue build + // Log server errors (5xx) as errors, all other errors as warnings + if (typedError instanceof http_client_1.HttpClientError && + typeof typedError.statusCode === 'number' && + typedError.statusCode >= 500) { + core.error(`Failed to restore: ${error.message}`); + } + else { + core.warning(`Failed to restore: ${error.message}`); + } } } finally { @@ -223,7 +242,13 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr core.debug(`Cache not found for version ${request.version} of keys: ${keys.join(', ')}`); return undefined; } - core.info(`Cache hit for: ${request.key}`); + const isRestoreKeyMatch = request.key !== response.matchedKey; + if (isRestoreKeyMatch) { + core.info(`Cache hit for restore-key: ${response.matchedKey}`); + } + else { + core.info(`Cache hit for: ${response.matchedKey}`); + } if (options === null || options === void 0 ? void 0 : options.lookupOnly) { core.info('Lookup only - skipping download'); return response.matchedKey; @@ -248,7 +273,15 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr } else { // Supress all non-validation cache related errors because caching should be optional - core.warning(`Failed to restore: ${error.message}`); + // Log server errors (5xx) as errors, all other errors as warnings + if (typedError instanceof http_client_1.HttpClientError && + typeof typedError.statusCode === 'number' && + typedError.statusCode >= 500) { + core.error(`Failed to restore: ${error.message}`); + } + else { + core.warning(`Failed to restore: ${error.message}`); + } } } finally { @@ -351,7 +384,15 @@ function saveCacheV1(paths, key, options, enableCrossOsArchive = false) { core.info(`Failed to save: ${typedError.message}`); } else { - core.warning(`Failed to save: ${typedError.message}`); + // Log server errors (5xx) as errors, all other errors as warnings + if (typedError instanceof http_client_1.HttpClientError && + typeof typedError.statusCode === 'number' && + typedError.statusCode >= 500) { + core.error(`Failed to save: ${typedError.message}`); + } + else { + core.warning(`Failed to save: ${typedError.message}`); + } } } finally { @@ -447,7 +488,15 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) { core.info(`Failed to save: ${typedError.message}`); } else { - core.warning(`Failed to save: ${typedError.message}`); + // Log server errors (5xx) as errors, all other errors as warnings + if (typedError instanceof http_client_1.HttpClientError && + typeof typedError.statusCode === 'number' && + typedError.statusCode >= 500) { + core.error(`Failed to save: ${typedError.message}`); + } + else { + core.warning(`Failed to save: ${typedError.message}`); + } } } finally { @@ -47832,6 +47881,10 @@ class RpcOutputStreamController { cmp: [], }; this._closed = false; + // --- RpcOutputStream async iterator API + // iterator state. + // is undefined when no iterator has been acquired yet. + this._itState = { q: [] }; } // --- RpcOutputStream callback API onNext(callback) { @@ -47931,10 +47984,6 @@ class RpcOutputStreamController { * messages are queued. */ [Symbol.asyncIterator]() { - // init the iterator state, enabling pushIt() - if (!this._itState) { - this._itState = { q: [] }; - } // if we are closed, we are definitely not receiving any more messages. // but we can't let the iterator get stuck. we want to either: // a) finish the new iterator immediately, because we are completed @@ -47967,8 +48016,6 @@ class RpcOutputStreamController { // this either resolves a pending promise, or enqueues the result. pushIt(result) { let state = this._itState; - if (!state) - return; // is the consumer waiting for us? if (state.p) { // yes, consumer is waiting for this promise. @@ -49880,6 +49927,7 @@ const reflection_equals_1 = __nccwpck_require__(4827); const binary_writer_1 = __nccwpck_require__(3957); const binary_reader_1 = __nccwpck_require__(2889); const baseDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})); +const messageTypeDescriptor = baseDescriptors[message_type_contract_1.MESSAGE_TYPE] = {}; /** * This standard message type provides reflection-based * operations to work with a message. @@ -49890,7 +49938,8 @@ class MessageType { this.typeName = name; this.fields = fields.map(reflection_info_1.normalizeFieldInfo); this.options = options !== null && options !== void 0 ? options : {}; - this.messagePrototype = Object.create(null, Object.assign(Object.assign({}, baseDescriptors), { [message_type_contract_1.MESSAGE_TYPE]: { value: this } })); + messageTypeDescriptor.value = this; + this.messagePrototype = Object.create(null, baseDescriptors); this.refTypeCheck = new reflection_type_check_1.ReflectionTypeCheck(this); this.refJsonReader = new reflection_json_reader_1.ReflectionJsonReader(this); this.refJsonWriter = new reflection_json_writer_1.ReflectionJsonWriter(this); @@ -51407,12 +51456,16 @@ class ReflectionJsonReader { target[localName] = field.T().internalJsonRead(jsonValue, options, target[localName]); break; case "enum": + if (jsonValue === null) + continue; let val = this.enum(field.T(), jsonValue, field.name, options.ignoreUnknownFields); if (val === false) continue; target[localName] = val; break; case "scalar": + if (jsonValue === null) + continue; target[localName] = this.scalar(jsonValue, field.T, field.L, field.name); break; } @@ -62822,7 +62875,7 @@ function _resolvePath(name, tmpDir, cb) { cb(null, path.join(parentDir, path.basename(pathToResolve))); }); } else { - fs.realpath(path, cb); + fs.realpath(pathToResolve, cb); } }); } @@ -93835,21 +93888,20 @@ function getAssetURL(versionInfo) { ext = "zip"; break; } - let arch = os_1.default.arch(); - switch (arch) { + let platformArch = "amd64"; + switch (os_1.default.arch()) { case "arm64": - arch = "arm64"; + platformArch = "arm64"; break; case "x64": - arch = "amd64"; + platformArch = "amd64"; break; - case "x32": case "ia32": - arch = "386"; + platformArch = "386"; break; } const noPrefix = versionInfo.TargetVersion.slice(1); - return `https://github.com/golangci/golangci-lint/releases/download/${versionInfo.TargetVersion}/golangci-lint-${noPrefix}-${platform}-${arch}.${ext}`; + return `https://github.com/golangci/golangci-lint/releases/download/${versionInfo.TargetVersion}/golangci-lint-${noPrefix}-${platform}-${platformArch}.${ext}`; } @@ -99204,7 +99256,7 @@ const checkStat = (stat, path, options) => stat.isFile() && checkPathExt(path, o /***/ ((module) => { "use strict"; -module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.0.3","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1"},"devDependencies":{"@types/node":"^22.13.9","@types/semver":"^6.0.0","typescript":"^5.2.2"}}'); +module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.0.5","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","semver":"^6.3.1"},"devDependencies":{"@types/node":"^22.13.9","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"}}'); /***/ }), diff --git a/dist/run/index.js b/dist/run/index.js index d56b35ddf8..37c95b92a8 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -48,6 +48,7 @@ const cacheTwirpClient = __importStar(__nccwpck_require__(6819)); const config_1 = __nccwpck_require__(7606); const tar_1 = __nccwpck_require__(5321); const constants_1 = __nccwpck_require__(8287); +const http_client_1 = __nccwpck_require__(4844); class ValidationError extends Error { constructor(message) { super(message); @@ -84,7 +85,17 @@ function checkKey(key) { * @returns boolean return true if Actions cache service feature is available, otherwise false */ function isFeatureAvailable() { - return !!process.env['ACTIONS_CACHE_URL']; + const cacheServiceVersion = (0, config_1.getCacheServiceVersion)(); + // Check availability based on cache service version + switch (cacheServiceVersion) { + case 'v2': + // For v2, we need ACTIONS_RESULTS_URL + return !!process.env['ACTIONS_RESULTS_URL']; + case 'v1': + default: + // For v1, we only need ACTIONS_CACHE_URL + return !!process.env['ACTIONS_CACHE_URL']; + } } exports.isFeatureAvailable = isFeatureAvailable; /** @@ -169,8 +180,16 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr throw error; } else { - // Supress all non-validation cache related errors because caching should be optional - core.warning(`Failed to restore: ${error.message}`); + // warn on cache restore failure and continue build + // Log server errors (5xx) as errors, all other errors as warnings + if (typedError instanceof http_client_1.HttpClientError && + typeof typedError.statusCode === 'number' && + typedError.statusCode >= 500) { + core.error(`Failed to restore: ${error.message}`); + } + else { + core.warning(`Failed to restore: ${error.message}`); + } } } finally { @@ -223,7 +242,13 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr core.debug(`Cache not found for version ${request.version} of keys: ${keys.join(', ')}`); return undefined; } - core.info(`Cache hit for: ${request.key}`); + const isRestoreKeyMatch = request.key !== response.matchedKey; + if (isRestoreKeyMatch) { + core.info(`Cache hit for restore-key: ${response.matchedKey}`); + } + else { + core.info(`Cache hit for: ${response.matchedKey}`); + } if (options === null || options === void 0 ? void 0 : options.lookupOnly) { core.info('Lookup only - skipping download'); return response.matchedKey; @@ -248,7 +273,15 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr } else { // Supress all non-validation cache related errors because caching should be optional - core.warning(`Failed to restore: ${error.message}`); + // Log server errors (5xx) as errors, all other errors as warnings + if (typedError instanceof http_client_1.HttpClientError && + typeof typedError.statusCode === 'number' && + typedError.statusCode >= 500) { + core.error(`Failed to restore: ${error.message}`); + } + else { + core.warning(`Failed to restore: ${error.message}`); + } } } finally { @@ -351,7 +384,15 @@ function saveCacheV1(paths, key, options, enableCrossOsArchive = false) { core.info(`Failed to save: ${typedError.message}`); } else { - core.warning(`Failed to save: ${typedError.message}`); + // Log server errors (5xx) as errors, all other errors as warnings + if (typedError instanceof http_client_1.HttpClientError && + typeof typedError.statusCode === 'number' && + typedError.statusCode >= 500) { + core.error(`Failed to save: ${typedError.message}`); + } + else { + core.warning(`Failed to save: ${typedError.message}`); + } } } finally { @@ -447,7 +488,15 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) { core.info(`Failed to save: ${typedError.message}`); } else { - core.warning(`Failed to save: ${typedError.message}`); + // Log server errors (5xx) as errors, all other errors as warnings + if (typedError instanceof http_client_1.HttpClientError && + typeof typedError.statusCode === 'number' && + typedError.statusCode >= 500) { + core.error(`Failed to save: ${typedError.message}`); + } + else { + core.warning(`Failed to save: ${typedError.message}`); + } } } finally { @@ -47832,6 +47881,10 @@ class RpcOutputStreamController { cmp: [], }; this._closed = false; + // --- RpcOutputStream async iterator API + // iterator state. + // is undefined when no iterator has been acquired yet. + this._itState = { q: [] }; } // --- RpcOutputStream callback API onNext(callback) { @@ -47931,10 +47984,6 @@ class RpcOutputStreamController { * messages are queued. */ [Symbol.asyncIterator]() { - // init the iterator state, enabling pushIt() - if (!this._itState) { - this._itState = { q: [] }; - } // if we are closed, we are definitely not receiving any more messages. // but we can't let the iterator get stuck. we want to either: // a) finish the new iterator immediately, because we are completed @@ -47967,8 +48016,6 @@ class RpcOutputStreamController { // this either resolves a pending promise, or enqueues the result. pushIt(result) { let state = this._itState; - if (!state) - return; // is the consumer waiting for us? if (state.p) { // yes, consumer is waiting for this promise. @@ -49880,6 +49927,7 @@ const reflection_equals_1 = __nccwpck_require__(4827); const binary_writer_1 = __nccwpck_require__(3957); const binary_reader_1 = __nccwpck_require__(2889); const baseDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})); +const messageTypeDescriptor = baseDescriptors[message_type_contract_1.MESSAGE_TYPE] = {}; /** * This standard message type provides reflection-based * operations to work with a message. @@ -49890,7 +49938,8 @@ class MessageType { this.typeName = name; this.fields = fields.map(reflection_info_1.normalizeFieldInfo); this.options = options !== null && options !== void 0 ? options : {}; - this.messagePrototype = Object.create(null, Object.assign(Object.assign({}, baseDescriptors), { [message_type_contract_1.MESSAGE_TYPE]: { value: this } })); + messageTypeDescriptor.value = this; + this.messagePrototype = Object.create(null, baseDescriptors); this.refTypeCheck = new reflection_type_check_1.ReflectionTypeCheck(this); this.refJsonReader = new reflection_json_reader_1.ReflectionJsonReader(this); this.refJsonWriter = new reflection_json_writer_1.ReflectionJsonWriter(this); @@ -51407,12 +51456,16 @@ class ReflectionJsonReader { target[localName] = field.T().internalJsonRead(jsonValue, options, target[localName]); break; case "enum": + if (jsonValue === null) + continue; let val = this.enum(field.T(), jsonValue, field.name, options.ignoreUnknownFields); if (val === false) continue; target[localName] = val; break; case "scalar": + if (jsonValue === null) + continue; target[localName] = this.scalar(jsonValue, field.T, field.L, field.name); break; } @@ -62822,7 +62875,7 @@ function _resolvePath(name, tmpDir, cb) { cb(null, path.join(parentDir, path.basename(pathToResolve))); }); } else { - fs.realpath(path, cb); + fs.realpath(pathToResolve, cb); } }); } @@ -93835,21 +93888,20 @@ function getAssetURL(versionInfo) { ext = "zip"; break; } - let arch = os_1.default.arch(); - switch (arch) { + let platformArch = "amd64"; + switch (os_1.default.arch()) { case "arm64": - arch = "arm64"; + platformArch = "arm64"; break; case "x64": - arch = "amd64"; + platformArch = "amd64"; break; - case "x32": case "ia32": - arch = "386"; + platformArch = "386"; break; } const noPrefix = versionInfo.TargetVersion.slice(1); - return `https://github.com/golangci/golangci-lint/releases/download/${versionInfo.TargetVersion}/golangci-lint-${noPrefix}-${platform}-${arch}.${ext}`; + return `https://github.com/golangci/golangci-lint/releases/download/${versionInfo.TargetVersion}/golangci-lint-${noPrefix}-${platform}-${platformArch}.${ext}`; } @@ -99204,7 +99256,7 @@ const checkStat = (stat, path, options) => stat.isFile() && checkPathExt(path, o /***/ ((module) => { "use strict"; -module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.0.3","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1"},"devDependencies":{"@types/node":"^22.13.9","@types/semver":"^6.0.0","typescript":"^5.2.2"}}'); +module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.0.5","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","semver":"^6.3.1"},"devDependencies":{"@types/node":"^22.13.9","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"}}'); /***/ }), diff --git a/package-lock.json b/package-lock.json index 68e6fd6812..6de387f718 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,18 +9,18 @@ "version": "8.0.0", "license": "MIT", "dependencies": { - "@actions/cache": "^4.0.3", + "@actions/cache": "^4.0.5", "@actions/core": "^1.11.1", "@actions/exec": "^1.1.1", "@actions/github": "^6.0.1", "@actions/http-client": "^2.2.3", "@actions/tool-cache": "^2.0.2", "@octokit/plugin-retry": "^6.1.0", - "@types/node": "^22.15.30", - "@types/semver": "^7.7.0", + "@types/node": "^24.3.1", + "@types/semver": "^7.7.1", "@types/tmp": "^0.2.6", "@types/which": "^3.0.4", - "tmp": "^0.2.4", + "tmp": "^0.2.5", "which": "^5.0.0" }, "devDependencies": { @@ -34,12 +34,15 @@ "eslint-plugin-simple-import-sort": "^12.1.1", "prettier": "^3.6.2", "typescript": "^5.9.2" + }, + "engines": { + "node": ">=24.0.0" } }, "node_modules/@actions/cache": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-4.0.3.tgz", - "integrity": "sha512-SvrqFtYJ7I48A/uXNkoJrnukx5weQv1fGquhs3+4nkByZThBH109KTIqj5x/cGV7JGNvb8dLPVywUOqX1fjiXg==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-4.0.5.tgz", + "integrity": "sha512-RjLz1/vvntOfp3FpkY3wB0MjVRbLq7bfQEuQG9UUTKwdtcYmFrKVmuD+9B6ADbzbkSfHM+dM4sMjdr3R4XIkFg==", "license": "MIT", "dependencies": { "@actions/core": "^1.11.1", @@ -50,7 +53,7 @@ "@azure/abort-controller": "^1.1.0", "@azure/ms-rest-js": "^2.6.0", "@azure/storage-blob": "^12.13.0", - "@protobuf-ts/plugin": "^2.9.4", + "@protobuf-ts/runtime-rpc": "^2.11.1", "semver": "^6.3.1" } }, @@ -657,81 +660,19 @@ "url": "https://opencollective.com/pkgr" } }, - "node_modules/@protobuf-ts/plugin": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/plugin/-/plugin-2.9.4.tgz", - "integrity": "sha512-Db5Laq5T3mc6ERZvhIhkj1rn57/p8gbWiCKxQWbZBBl20wMuqKoHbRw4tuD7FyXi+IkwTToaNVXymv5CY3E8Rw==", - "license": "Apache-2.0", - "dependencies": { - "@protobuf-ts/plugin-framework": "^2.9.4", - "@protobuf-ts/protoc": "^2.9.4", - "@protobuf-ts/runtime": "^2.9.4", - "@protobuf-ts/runtime-rpc": "^2.9.4", - "typescript": "^3.9" - }, - "bin": { - "protoc-gen-dump": "bin/protoc-gen-dump", - "protoc-gen-ts": "bin/protoc-gen-ts" - } - }, - "node_modules/@protobuf-ts/plugin-framework": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/plugin-framework/-/plugin-framework-2.9.4.tgz", - "integrity": "sha512-9nuX1kjdMliv+Pes8dQCKyVhjKgNNfwxVHg+tx3fLXSfZZRcUHMc1PMwB9/vTvc6gBKt9QGz5ERqSqZc0++E9A==", - "license": "(Apache-2.0 AND BSD-3-Clause)", - "dependencies": { - "@protobuf-ts/runtime": "^2.9.4", - "typescript": "^3.9" - } - }, - "node_modules/@protobuf-ts/plugin-framework/node_modules/typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/@protobuf-ts/plugin/node_modules/typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/@protobuf-ts/protoc": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.9.4.tgz", - "integrity": "sha512-hQX+nOhFtrA+YdAXsXEDrLoGJqXHpgv4+BueYF0S9hy/Jq0VRTVlJS1Etmf4qlMt/WdigEes5LOd/LDzui4GIQ==", - "license": "Apache-2.0", - "bin": { - "protoc": "protoc.js" - } - }, "node_modules/@protobuf-ts/runtime": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.4.tgz", - "integrity": "sha512-vHRFWtJJB/SiogWDF0ypoKfRIZ41Kq+G9cEFj6Qm1eQaAhJ1LDFvgZ7Ja4tb3iLOQhz0PaoPnnOijF1qmEqTxg==", + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.11.1.tgz", + "integrity": "sha512-KuDaT1IfHkugM2pyz+FwiY80ejWrkH1pAtOBOZFuR6SXEFTsnb/jiQWQ1rCIrcKx2BtyxnxW6BWwsVSA/Ie+WQ==", "license": "(Apache-2.0 AND BSD-3-Clause)" }, "node_modules/@protobuf-ts/runtime-rpc": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.4.tgz", - "integrity": "sha512-y9L9JgnZxXFqH5vD4d7j9duWvIJ7AShyBRoNKJGhu9Q27qIbchfzli66H9RvrQNIFk5ER7z1Twe059WZGqERcA==", + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.11.1.tgz", + "integrity": "sha512-4CqqUmNA+/uMz00+d3CYKgElXO9VrEbucjnBFEjqI4GuDrEQ32MaI3q+9qPBvIGOlL4PmHXrzM32vBPWRhQKWQ==", "license": "Apache-2.0", "dependencies": { - "@protobuf-ts/runtime": "^2.9.4" + "@protobuf-ts/runtime": "^2.11.1" } }, "node_modules/@rtsao/scc": { @@ -747,12 +688,12 @@ "dev": true }, "node_modules/@types/node": { - "version": "22.15.30", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.30.tgz", - "integrity": "sha512-6Q7lr06bEHdlfplU6YRbgG1SFBdlsfNC4/lX+SkhiTs0cpJkOElmWls8PxDFv4yY/xKb8Y6SO0OmSX4wgqTZbA==", + "version": "24.3.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.1.tgz", + "integrity": "sha512-3vXmQDXy+woz+gnrTvuvNrPzekOi+Ds0ReMxw0LzBiK3a+1k0kQn9f2NWk+lgD4rJehFUmYy2gMhJ2ZI+7YP9g==", "license": "MIT", "dependencies": { - "undici-types": "~6.21.0" + "undici-types": "~7.10.0" } }, "node_modules/@types/node-fetch": { @@ -781,9 +722,9 @@ } }, "node_modules/@types/semver": { - "version": "7.7.0", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.7.0.tgz", - "integrity": "sha512-k107IF4+Xr7UHjwDc7Cfd6PRQfbdkiRabXGRjo07b4WyPahFBZCZ1sE+BNxYIJPPg73UkfOsVOLwqVc/6ETrIA==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-FmgJfu+MOcQ370SD0ev7EI8TlCAfKYU+B4m5T3yXc1CiRN94g/SZPtsCkk506aUDtlMnFZvasDwHHUcZUEaYuA==", "license": "MIT" }, "node_modules/@types/tmp": { @@ -4042,9 +3983,9 @@ "dev": true }, "node_modules/tmp": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.4.tgz", - "integrity": "sha512-UdiSoX6ypifLmrfQ/XfiawN6hkjSBpCjhKxxZcWlUUmoXLaCKQU0bx4HF/tdDK2uzRuchf1txGvrWBzYREssoQ==", + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz", + "integrity": "sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==", "license": "MIT", "engines": { "node": ">=14.14" @@ -4255,9 +4196,9 @@ } }, "node_modules/undici-types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", - "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz", + "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==", "license": "MIT" }, "node_modules/universal-user-agent": { diff --git a/package.json b/package.json index afed731ca8..c3577ebe9e 100644 --- a/package.json +++ b/package.json @@ -23,19 +23,22 @@ }, "author": "golangci", "license": "MIT", + "engines": { + "node": ">=24.0.0" + }, "dependencies": { - "@actions/cache": "^4.0.3", + "@actions/cache": "^4.0.5", "@actions/core": "^1.11.1", "@actions/exec": "^1.1.1", "@actions/github": "^6.0.1", "@actions/http-client": "^2.2.3", "@octokit/plugin-retry": "^6.1.0", "@actions/tool-cache": "^2.0.2", - "@types/node": "^22.15.30", - "@types/semver": "^7.7.0", + "@types/node": "^24.3.1", + "@types/semver": "^7.7.1", "@types/tmp": "^0.2.6", "@types/which": "^3.0.4", - "tmp": "^0.2.4", + "tmp": "^0.2.5", "which": "^5.0.0" }, "devDependencies": { diff --git a/src/install.ts b/src/install.ts index 1f5083fd6f..8d71ec79e5 100644 --- a/src/install.ts +++ b/src/install.ts @@ -1,6 +1,6 @@ import * as core from "@actions/core" import * as tc from "@actions/tool-cache" -import { exec, ExecOptions } from "child_process" +import { exec, ExecOptionsWithStringEncoding } from "child_process" import os from "os" import path from "path" import { promisify } from "util" @@ -82,7 +82,7 @@ async function goInstall(versionInfo: VersionInfo): Promise { const startedAt = Date.now() - const options: ExecOptions = { env: { ...process.env, CGO_ENABLED: "1" } } + const options: ExecOptionsWithStringEncoding = { env: { ...process.env, CGO_ENABLED: "1" } } const exres = await execShellCommand( `go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${versionInfo.TargetVersion}`, @@ -160,21 +160,20 @@ function getAssetURL(versionInfo: VersionInfo): string { break } - let arch = os.arch() - switch (arch) { + let platformArch = "amd64" + switch (os.arch()) { case "arm64": - arch = "arm64" + platformArch = "arm64" break case "x64": - arch = "amd64" + platformArch = "amd64" break - case "x32": case "ia32": - arch = "386" + platformArch = "386" break } const noPrefix = versionInfo.TargetVersion.slice(1) - return `https://github.com/golangci/golangci-lint/releases/download/${versionInfo.TargetVersion}/golangci-lint-${noPrefix}-${platform}-${arch}.${ext}` + return `https://github.com/golangci/golangci-lint/releases/download/${versionInfo.TargetVersion}/golangci-lint-${noPrefix}-${platform}-${platformArch}.${ext}` } diff --git a/src/run.ts b/src/run.ts index 6418ab5070..8f79b998d6 100644 --- a/src/run.ts +++ b/src/run.ts @@ -1,6 +1,6 @@ import * as core from "@actions/core" import * as github from "@actions/github" -import { exec, ExecOptions } from "child_process" +import { exec, ExecOptionsWithStringEncoding } from "child_process" import * as fs from "fs" import * as path from "path" import { promisify } from "util" @@ -116,7 +116,7 @@ async function runLint(binPath: string, patchPath: string): Promise { } } - const cmdArgs: ExecOptions = {} + const cmdArgs: ExecOptionsWithStringEncoding = {} const workingDirectory = core.getInput(`working-directory`) if (workingDirectory) { @@ -156,7 +156,7 @@ async function runLint(binPath: string, patchPath: string): Promise { core.info(`Ran golangci-lint in ${Date.now() - startedAt}ms`) } -async function runVerify(binPath: string, userArgsMap: Map, cmdArgs: ExecOptions): Promise { +async function runVerify(binPath: string, userArgsMap: Map, cmdArgs: ExecOptionsWithStringEncoding): Promise { const verify = core.getBooleanInput(`verify`, { required: true }) if (!verify) { return @@ -178,7 +178,7 @@ async function runVerify(binPath: string, userArgsMap: Map, cmdA printOutput(res) } -async function getConfigPath(binPath: string, userArgsMap: Map, cmdArgs: ExecOptions): Promise { +async function getConfigPath(binPath: string, userArgsMap: Map, cmdArgs: ExecOptionsWithStringEncoding): Promise { let cmdConfigPath = `${binPath} config path` if (userArgsMap.get("config")) { cmdConfigPath += ` --config=${userArgsMap.get("config")}`