Improve warning message for missing ImageOS env. variable (self-hosted runners) (#59)

This commit is contained in:
Paulo F. Oliveira authored and GitHub committed 2021-07-12 18:35:08 +01:00
1 parent 830642517c
commit 9283f857f1
5 files changed
+70 -7

No files matched your search

+12 -1
View File
@@ -345,8 +345,19 @@ function getRunnerOSVersion() {
win16: 'windows-2016',
win19: 'windows-2019',
}
const containerFromEnvImageOS = ImageOSToContainer[process.env.ImageOS]
return ImageOSToContainer[process.env.ImageOS]
if (!containerFromEnvImageOS) {
throw new Error(
"Tried to map a target OS from env. variable 'ImageOS', but failed. If you're using a " +
"self-hosted runner, you should set 'env': 'ImageOS': ... to one of the following: " +
"['" +
`${Object.keys(ImageOSToContainer).join("', '")}` +
"']",
)
}
return containerFromEnvImageOS
}
async function get(url0, pageIdxs) {