fix: use BUILD_ID as backup for determining os version (#912)

On Arch Linux based runners, the setup fails with because
`/etc/os-release` does not contain `VERSION_ID` or `VERSION_CODENAME`.
It does contain a `BUILD_ID` which is set to `rolling`:

```sh
$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo
```

This PR makes `getLinuxOSNameVersion` return `arch-rolling`.

There is no update from arch that would change the returned value, so
the same cache will always be used. Is this an issue? I'm not sure. At
least it's better than crashing because `os-release` does not contain
the expected values :).
This commit is contained in:
Hans Gaiser
2026-06-09 13:12:37 +02:00
committed by GitHub
parent 21d5da3bc3
commit ed73b5df24
2 changed files with 9 additions and 1 deletions

4
dist/setup/index.cjs generated vendored
View File

@@ -91160,12 +91160,16 @@ function getLinuxOSNameVersion() {
const id = parseOsReleaseValue(content, "ID"); const id = parseOsReleaseValue(content, "ID");
const versionId2 = parseOsReleaseValue(content, "VERSION_ID"); const versionId2 = parseOsReleaseValue(content, "VERSION_ID");
const versionCodename = parseOsReleaseValue(content, "VERSION_CODENAME"); const versionCodename = parseOsReleaseValue(content, "VERSION_CODENAME");
const buildId = parseOsReleaseValue(content, "BUILD_ID");
if (id && versionId2) { if (id && versionId2) {
return `${id}-${versionId2}`; return `${id}-${versionId2}`;
} }
if (id && versionCodename) { if (id && versionCodename) {
return `${id}-${versionCodename}`; return `${id}-${versionCodename}`;
} }
if (id && buildId) {
return `${id}-${buildId}`;
}
} catch { } catch {
} }
} }

View File

@@ -109,8 +109,9 @@ function getLinuxOSNameVersion(): string {
const id = parseOsReleaseValue(content, "ID"); const id = parseOsReleaseValue(content, "ID");
const versionId = parseOsReleaseValue(content, "VERSION_ID"); const versionId = parseOsReleaseValue(content, "VERSION_ID");
// Fallback for rolling releases (debian:unstable/testing, arch, etc.) // Fallback for rolling releases (debian:unstable/testing, arch, etc.)
// that don't have VERSION_ID but have VERSION_CODENAME // that don't have VERSION_ID but have VERSION_CODENAME or BUILD_ID
const versionCodename = parseOsReleaseValue(content, "VERSION_CODENAME"); const versionCodename = parseOsReleaseValue(content, "VERSION_CODENAME");
const buildId = parseOsReleaseValue(content, "BUILD_ID");
if (id && versionId) { if (id && versionId) {
return `${id}-${versionId}`; return `${id}-${versionId}`;
@@ -118,6 +119,9 @@ function getLinuxOSNameVersion(): string {
if (id && versionCodename) { if (id && versionCodename) {
return `${id}-${versionCodename}`; return `${id}-${versionCodename}`;
} }
if (id && buildId) {
return `${id}-${buildId}`;
}
} catch { } catch {
// Try next file // Try next file
} }