mirror of
https://github.com/actions/setup-python
synced 2025-04-05 14:59:42 +00:00
Update action to node20 (#772)
This commit is contained in:
@ -4,11 +4,18 @@ import * as cache from '@actions/cache';
|
||||
import fs from 'fs';
|
||||
import {State} from './cache-distributions/cache-distributor';
|
||||
|
||||
export async function run() {
|
||||
// Added early exit to resolve issue with slow post action step:
|
||||
// - https://github.com/actions/setup-node/issues/878
|
||||
// https://github.com/actions/cache/pull/1217
|
||||
export async function run(earlyExit?: boolean) {
|
||||
try {
|
||||
const cache = core.getInput('cache');
|
||||
if (cache) {
|
||||
await saveCache(cache);
|
||||
|
||||
if (earlyExit) {
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
const err = error as Error;
|
||||
@ -76,4 +83,4 @@ function isCacheDirectoryExists(cacheDirectory: string[]) {
|
||||
return result;
|
||||
}
|
||||
|
||||
run();
|
||||
run(true);
|
||||
|
@ -4,9 +4,11 @@ import * as core from '@actions/core';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as semver from 'semver';
|
||||
import * as httpm from '@actions/http-client';
|
||||
import * as ifm from '@actions/http-client/interfaces';
|
||||
import * as ifm from '@actions/http-client/lib/interfaces';
|
||||
import * as exec from '@actions/exec';
|
||||
|
||||
import fs from 'fs';
|
||||
import * as http from 'http';
|
||||
|
||||
import {
|
||||
IS_WINDOWS,
|
||||
@ -108,7 +110,7 @@ export async function installGraalPy(
|
||||
export async function getAvailableGraalPyVersions() {
|
||||
const http: httpm.HttpClient = new httpm.HttpClient('tool-cache');
|
||||
|
||||
const headers: ifm.IHeaders = {};
|
||||
const headers: http.OutgoingHttpHeaders = {};
|
||||
if (AUTH) {
|
||||
headers.authorization = AUTH;
|
||||
}
|
||||
@ -117,7 +119,7 @@ export async function getAvailableGraalPyVersions() {
|
||||
'https://api.github.com/repos/oracle/graalpython/releases';
|
||||
const result: IGraalPyManifestRelease[] = [];
|
||||
do {
|
||||
const response: ifm.ITypedResponse<IGraalPyManifestRelease[]> =
|
||||
const response: ifm.TypedResponse<IGraalPyManifestRelease[]> =
|
||||
await http.getJson(url, headers);
|
||||
if (!response.result) {
|
||||
throw new Error(
|
||||
|
@ -6,7 +6,9 @@ import * as path from 'path';
|
||||
import * as semver from 'semver';
|
||||
import * as toml from '@iarna/toml';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as ifm from '@actions/http-client/interfaces';
|
||||
import * as ifm from '@actions/http-client/lib/interfaces';
|
||||
|
||||
import * as http from 'http';
|
||||
|
||||
export const IS_WINDOWS = process.platform === 'win32';
|
||||
export const IS_LINUX = process.platform === 'linux';
|
||||
@ -290,8 +292,8 @@ export function getBinaryDirectory(installDir: string) {
|
||||
/**
|
||||
* Extract next page URL from a HTTP response "link" header. Such headers are used in GitHub APIs.
|
||||
*/
|
||||
export function getNextPageUrl<T>(response: ifm.ITypedResponse<T>) {
|
||||
const responseHeaders = <ifm.IHeaders>response.headers;
|
||||
export function getNextPageUrl<T>(response: ifm.TypedResponse<T>) {
|
||||
const responseHeaders = <http.OutgoingHttpHeaders>response.headers;
|
||||
const linkHeader = responseHeaders.link;
|
||||
if (typeof linkHeader === 'string') {
|
||||
for (const link of linkHeader.split(/\s*,\s*/)) {
|
||||
|
Reference in New Issue
Block a user