From 3deccc00754b93ea5d734f5c886a9a5d472ad595 Mon Sep 17 00:00:00 2001 From: Kevin Stillhammer Date: Tue, 7 Oct 2025 08:44:57 +0200 Subject: [PATCH] Use node24 instead of node20 (#608) --- .github/actionlint.yaml | 4 +++ .github/workflows/test.yml | 2 +- action.yml | 2 +- dist/setup/index.js | 3 ++- dist/update-known-versions/index.js | 3 ++- src/download/download-version.ts | 21 +++++++++------ src/update-known-versions.ts | 15 ++++++++--- src/utils/octokit.ts | 40 +++++++++++++---------------- tsconfig.json | 4 +-- 9 files changed, 54 insertions(+), 40 deletions(-) diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml index 2830cfa..036f683 100644 --- a/.github/actionlint.yaml +++ b/.github/actionlint.yaml @@ -7,3 +7,7 @@ self-hosted-runner: # organization. `null` means disabling configuration variables check. # Empty array means no configuration variable is allowed. config-variables: null +paths: + .github/workflows/test.yml: + ignore: + - 'invalid runner name.+' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7c3b59d..0cb10b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,7 @@ jobs: uses: zizmorcore/zizmor-action@e673c3917a1aef3c65c972347ed84ccd013ecda4 # v0.2.0 - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: - node-version: "20" + node-version: "24" - run: | npm install - run: | diff --git a/action.yml b/action.yml index c1a9426..ea7133b 100644 --- a/action.yml +++ b/action.yml @@ -84,7 +84,7 @@ outputs: cache-hit: description: "A boolean value to indicate a cache entry was found" runs: - using: "node20" + using: "node24" main: "dist/setup/index.js" post: "dist/save-cache/index.js" post-if: success() diff --git a/dist/setup/index.js b/dist/setup/index.js index cef5b6c..db11550 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -129771,7 +129771,8 @@ const DEFAULTS = { baseUrl: "https://api.github.com", userAgent: "setup-uv", }; -exports.Octokit = core_1.Octokit.plugin(plugin_paginate_rest_1.paginateRest, plugin_rest_endpoint_methods_1.legacyRestEndpointMethods).defaults(function buildDefaults(options) { +const OctokitWithPlugins = core_1.Octokit.plugin(plugin_paginate_rest_1.paginateRest, plugin_rest_endpoint_methods_1.legacyRestEndpointMethods); +exports.Octokit = OctokitWithPlugins.defaults(function buildDefaults(options) { return { ...DEFAULTS, ...options, diff --git a/dist/update-known-versions/index.js b/dist/update-known-versions/index.js index 7a1f49c..615869d 100644 --- a/dist/update-known-versions/index.js +++ b/dist/update-known-versions/index.js @@ -65801,7 +65801,8 @@ const DEFAULTS = { baseUrl: "https://api.github.com", userAgent: "setup-uv", }; -exports.Octokit = core_1.Octokit.plugin(plugin_paginate_rest_1.paginateRest, plugin_rest_endpoint_methods_1.legacyRestEndpointMethods).defaults(function buildDefaults(options) { +const OctokitWithPlugins = core_1.Octokit.plugin(plugin_paginate_rest_1.paginateRest, plugin_rest_endpoint_methods_1.legacyRestEndpointMethods); +exports.Octokit = OctokitWithPlugins.defaults(function buildDefaults(options) { return { ...DEFAULTS, ...options, diff --git a/src/download/download-version.ts b/src/download/download-version.ts index 37864a3..118907f 100644 --- a/src/download/download-version.ts +++ b/src/download/download-version.ts @@ -2,6 +2,7 @@ import { promises as fs } from "node:fs"; import * as path from "node:path"; import * as core from "@actions/core"; import * as tc from "@actions/tool-cache"; +import type { Endpoints } from "@octokit/types"; import * as pep440 from "@renovatebot/pep440"; import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants"; import { Octokit } from "../utils/octokit"; @@ -12,6 +13,9 @@ import { getLatestKnownVersion as getLatestVersionInManifest, } from "./version-manifest"; +type Release = + Endpoints["GET /repos/{owner}/{repo}/releases"]["response"]["data"][number]; + export function tryGetFromToolCache( arch: Architecture, version: string, @@ -186,13 +190,14 @@ async function getAvailableVersions(githubToken: string): Promise { } } -async function getReleaseTagNames( - octokit: InstanceType, -): Promise { - const response = await octokit.paginate(octokit.rest.repos.listReleases, { - owner: OWNER, - repo: REPO, - }); +async function getReleaseTagNames(octokit: Octokit): Promise { + const response: Release[] = await octokit.paginate( + octokit.rest.repos.listReleases, + { + owner: OWNER, + repo: REPO, + }, + ); const releaseTagNames = response.map((release) => release.tag_name); if (releaseTagNames.length === 0) { throw Error( @@ -233,7 +238,7 @@ async function getLatestVersion(githubToken: string) { return latestRelease.tag_name; } -async function getLatestRelease(octokit: InstanceType) { +async function getLatestRelease(octokit: Octokit) { const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({ owner: OWNER, repo: REPO, diff --git a/src/update-known-versions.ts b/src/update-known-versions.ts index 177f08c..c785493 100644 --- a/src/update-known-versions.ts +++ b/src/update-known-versions.ts @@ -1,4 +1,5 @@ import * as core from "@actions/core"; +import type { Endpoints } from "@octokit/types"; import * as semver from "semver"; import { updateChecksums } from "./download/checksum/update-known-checksums"; import { @@ -8,6 +9,9 @@ import { import { OWNER, REPO } from "./utils/constants"; import { Octokit } from "./utils/octokit"; +type Release = + Endpoints["GET /repos/{owner}/{repo}/releases"]["response"]["data"][number]; + async function run(): Promise { const checksumFilePath = process.argv.slice(2)[0]; const versionsManifestFile = process.argv.slice(2)[1]; @@ -31,10 +35,13 @@ async function run(): Promise { return; } - const releases = await octokit.paginate(octokit.rest.repos.listReleases, { - owner: OWNER, - repo: REPO, - }); + const releases: Release[] = await octokit.paginate( + octokit.rest.repos.listReleases, + { + owner: OWNER, + repo: REPO, + }, + ); const checksumDownloadUrls: string[] = releases.flatMap((release) => release.assets .filter((asset) => asset.name.endsWith(".sha256")) diff --git a/src/utils/octokit.ts b/src/utils/octokit.ts index 5adbe52..d9e1836 100644 --- a/src/utils/octokit.ts +++ b/src/utils/octokit.ts @@ -1,8 +1,5 @@ +import type { OctokitOptions } from "@octokit/core"; import { Octokit as Core } from "@octokit/core"; -import type { - Constructor, - OctokitOptions, -} from "@octokit/core/dist-types/types"; import { type PaginateInterface, paginateRest, @@ -17,22 +14,21 @@ const DEFAULTS = { userAgent: "setup-uv", }; -export const Octokit: typeof Core & - Constructor< - { - paginate: PaginateInterface; - } & ReturnType - > = Core.plugin(paginateRest, legacyRestEndpointMethods).defaults( - function buildDefaults(options: OctokitOptions): OctokitOptions { - return { - ...DEFAULTS, - ...options, - request: { - fetch: customFetch, - ...options.request, - }, - }; - }, -); +const OctokitWithPlugins = Core.plugin(paginateRest, legacyRestEndpointMethods); -export type Octokit = InstanceType; +export const Octokit = OctokitWithPlugins.defaults(function buildDefaults( + options: OctokitOptions, +): OctokitOptions { + return { + ...DEFAULTS, + ...options, + request: { + fetch: customFetch, + ...options.request, + }, + }; +}); + +export type Octokit = InstanceType & { + paginate: PaginateInterface; +}; diff --git a/tsconfig.json b/tsconfig.json index afae20a..5ff283b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,12 +1,12 @@ { "compilerOptions": { "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, + "module": "nodenext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, "outDir": "./lib" /* Redirect output structure to the directory. */, "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, "strict": true /* Enable all strict type-checking options. */, - "target": "ES2022" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "target": "ES2024" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ }, "exclude": ["node_modules", "**/*.test.ts"] }