Use node24 instead of node20 (#608)

This commit is contained in:
Kevin Stillhammer
2025-10-07 08:44:57 +02:00
committed by GitHub
parent d9ee7e2f26
commit 3deccc0075
9 changed files with 54 additions and 40 deletions

View File

@@ -7,3 +7,7 @@ self-hosted-runner:
# organization. `null` means disabling configuration variables check. # organization. `null` means disabling configuration variables check.
# Empty array means no configuration variable is allowed. # Empty array means no configuration variable is allowed.
config-variables: null config-variables: null
paths:
.github/workflows/test.yml:
ignore:
- 'invalid runner name.+'

View File

@@ -30,7 +30,7 @@ jobs:
uses: zizmorcore/zizmor-action@e673c3917a1aef3c65c972347ed84ccd013ecda4 # v0.2.0 uses: zizmorcore/zizmor-action@e673c3917a1aef3c65c972347ed84ccd013ecda4 # v0.2.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with: with:
node-version: "20" node-version: "24"
- run: | - run: |
npm install npm install
- run: | - run: |

View File

@@ -84,7 +84,7 @@ outputs:
cache-hit: cache-hit:
description: "A boolean value to indicate a cache entry was found" description: "A boolean value to indicate a cache entry was found"
runs: runs:
using: "node20" using: "node24"
main: "dist/setup/index.js" main: "dist/setup/index.js"
post: "dist/save-cache/index.js" post: "dist/save-cache/index.js"
post-if: success() post-if: success()

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

@@ -129771,7 +129771,8 @@ const DEFAULTS = {
baseUrl: "https://api.github.com", baseUrl: "https://api.github.com",
userAgent: "setup-uv", 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 { return {
...DEFAULTS, ...DEFAULTS,
...options, ...options,

View File

@@ -65801,7 +65801,8 @@ const DEFAULTS = {
baseUrl: "https://api.github.com", baseUrl: "https://api.github.com",
userAgent: "setup-uv", 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 { return {
...DEFAULTS, ...DEFAULTS,
...options, ...options,

View File

@@ -2,6 +2,7 @@ import { promises as fs } from "node:fs";
import * as path from "node:path"; import * as path from "node:path";
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 type { Endpoints } from "@octokit/types";
import * as pep440 from "@renovatebot/pep440"; import * as pep440 from "@renovatebot/pep440";
import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants"; import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
import { Octokit } from "../utils/octokit"; import { Octokit } from "../utils/octokit";
@@ -12,6 +13,9 @@ import {
getLatestKnownVersion as getLatestVersionInManifest, getLatestKnownVersion as getLatestVersionInManifest,
} from "./version-manifest"; } from "./version-manifest";
type Release =
Endpoints["GET /repos/{owner}/{repo}/releases"]["response"]["data"][number];
export function tryGetFromToolCache( export function tryGetFromToolCache(
arch: Architecture, arch: Architecture,
version: string, version: string,
@@ -186,13 +190,14 @@ async function getAvailableVersions(githubToken: string): Promise<string[]> {
} }
} }
async function getReleaseTagNames( async function getReleaseTagNames(octokit: Octokit): Promise<string[]> {
octokit: InstanceType<typeof Octokit>, const response: Release[] = await octokit.paginate(
): Promise<string[]> { octokit.rest.repos.listReleases,
const response = await octokit.paginate(octokit.rest.repos.listReleases, { {
owner: OWNER, owner: OWNER,
repo: REPO, repo: REPO,
}); },
);
const releaseTagNames = response.map((release) => release.tag_name); const releaseTagNames = response.map((release) => release.tag_name);
if (releaseTagNames.length === 0) { if (releaseTagNames.length === 0) {
throw Error( throw Error(
@@ -233,7 +238,7 @@ async function getLatestVersion(githubToken: string) {
return latestRelease.tag_name; return latestRelease.tag_name;
} }
async function getLatestRelease(octokit: InstanceType<typeof Octokit>) { async function getLatestRelease(octokit: Octokit) {
const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({ const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({
owner: OWNER, owner: OWNER,
repo: REPO, repo: REPO,

View File

@@ -1,4 +1,5 @@
import * as core from "@actions/core"; import * as core from "@actions/core";
import type { Endpoints } from "@octokit/types";
import * as semver from "semver"; import * as semver from "semver";
import { updateChecksums } from "./download/checksum/update-known-checksums"; import { updateChecksums } from "./download/checksum/update-known-checksums";
import { import {
@@ -8,6 +9,9 @@ import {
import { OWNER, REPO } from "./utils/constants"; import { OWNER, REPO } from "./utils/constants";
import { Octokit } from "./utils/octokit"; import { Octokit } from "./utils/octokit";
type Release =
Endpoints["GET /repos/{owner}/{repo}/releases"]["response"]["data"][number];
async function run(): Promise<void> { async function run(): Promise<void> {
const checksumFilePath = process.argv.slice(2)[0]; const checksumFilePath = process.argv.slice(2)[0];
const versionsManifestFile = process.argv.slice(2)[1]; const versionsManifestFile = process.argv.slice(2)[1];
@@ -31,10 +35,13 @@ async function run(): Promise<void> {
return; return;
} }
const releases = await octokit.paginate(octokit.rest.repos.listReleases, { const releases: Release[] = await octokit.paginate(
owner: OWNER, octokit.rest.repos.listReleases,
repo: REPO, {
}); owner: OWNER,
repo: REPO,
},
);
const checksumDownloadUrls: string[] = releases.flatMap((release) => const checksumDownloadUrls: string[] = releases.flatMap((release) =>
release.assets release.assets
.filter((asset) => asset.name.endsWith(".sha256")) .filter((asset) => asset.name.endsWith(".sha256"))

View File

@@ -1,8 +1,5 @@
import type { OctokitOptions } from "@octokit/core";
import { Octokit as Core } from "@octokit/core"; import { Octokit as Core } from "@octokit/core";
import type {
Constructor,
OctokitOptions,
} from "@octokit/core/dist-types/types";
import { import {
type PaginateInterface, type PaginateInterface,
paginateRest, paginateRest,
@@ -17,22 +14,21 @@ const DEFAULTS = {
userAgent: "setup-uv", userAgent: "setup-uv",
}; };
export const Octokit: typeof Core & const OctokitWithPlugins = Core.plugin(paginateRest, legacyRestEndpointMethods);
Constructor<
{
paginate: PaginateInterface;
} & ReturnType<typeof legacyRestEndpointMethods>
> = Core.plugin(paginateRest, legacyRestEndpointMethods).defaults(
function buildDefaults(options: OctokitOptions): OctokitOptions {
return {
...DEFAULTS,
...options,
request: {
fetch: customFetch,
...options.request,
},
};
},
);
export type Octokit = InstanceType<typeof Octokit>; export const Octokit = OctokitWithPlugins.defaults(function buildDefaults(
options: OctokitOptions,
): OctokitOptions {
return {
...DEFAULTS,
...options,
request: {
fetch: customFetch,
...options.request,
},
};
});
export type Octokit = InstanceType<typeof OctokitWithPlugins> & {
paginate: PaginateInterface;
};

View File

@@ -1,12 +1,12 @@
{ {
"compilerOptions": { "compilerOptions": {
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, "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. */, "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
"outDir": "./lib" /* Redirect output structure to the directory. */, "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. */, "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. */, "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"] "exclude": ["node_modules", "**/*.test.ts"]
} }