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

This commit is contained in:
Paulo F. Oliveira
2021-07-12 18:35:08 +01:00
committed by GitHub
parent 830642517c
commit 9283f857f1
5 changed files with 70 additions and 7 deletions
+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) {