mirror of
https://github.com/actions/setup-python.git
synced 2026-06-23 08:12:48 +00:00
Refactor OS info retrieval to use getOSInfo and handle null cases for improved reliability
This commit is contained in:
parent
f1ee88690f
commit
5ad36cd2ac
5
dist/cache-save/index.js
vendored
5
dist/cache-save/index.js
vendored
@ -51256,7 +51256,10 @@ class CacheDistributor {
|
||||
if (!utils_1.IS_LINUX) {
|
||||
return '';
|
||||
}
|
||||
const osInfo = await (0, utils_1.getLinuxInfo)();
|
||||
const osInfo = await (0, utils_1.getOSInfo)();
|
||||
if (!osInfo) {
|
||||
return '';
|
||||
}
|
||||
// lsb_release reports RHEL as "RedHatEnterpriseLinux" while /etc/os-release
|
||||
// reports it as "rhel"; normalize both to "rhel" so the key is consistent.
|
||||
const normalizedName = osInfo.osName.toLowerCase();
|
||||
|
||||
5
dist/setup/index.js
vendored
5
dist/setup/index.js
vendored
@ -53838,7 +53838,10 @@ class CacheDistributor {
|
||||
if (!utils_1.IS_LINUX) {
|
||||
return '';
|
||||
}
|
||||
const osInfo = await (0, utils_1.getLinuxInfo)();
|
||||
const osInfo = await (0, utils_1.getOSInfo)();
|
||||
if (!osInfo) {
|
||||
return '';
|
||||
}
|
||||
// lsb_release reports RHEL as "RedHatEnterpriseLinux" while /etc/os-release
|
||||
// reports it as "rhel"; normalize both to "rhel" so the key is consistent.
|
||||
const normalizedName = osInfo.osName.toLowerCase();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import {getLinuxInfo, IS_LINUX} from '../utils';
|
||||
import {getOSInfo, IS_LINUX} from '../utils';
|
||||
import {CACHE_DEPENDENCY_BACKUP_PATH} from './constants';
|
||||
|
||||
export enum State {
|
||||
@ -32,7 +32,11 @@ abstract class CacheDistributor {
|
||||
return '';
|
||||
}
|
||||
|
||||
const osInfo = await getLinuxInfo();
|
||||
const osInfo = await getOSInfo();
|
||||
if (!osInfo) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// lsb_release reports RHEL as "RedHatEnterpriseLinux" while /etc/os-release
|
||||
// reports it as "rhel"; normalize both to "rhel" so the key is consistent.
|
||||
const normalizedName = osInfo.osName.toLowerCase();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user