Resolve env flags to boolean early

So inner functions can assume booleans and forget about the fact that
they were once strings.

Also allow both true and 1 to set it.
main
Jacobo de Vera 2024-07-20 01:11:41 +01:00
parent 60ae549d13
commit 81e11cde9b
No known key found for this signature in database
GPG Key ID: A0978FF8800D5BD7
1 changed files with 2 additions and 2 deletions

View File

@ -115,8 +115,8 @@ async function main() {
return;
}
const mirrorPrivateRepositories = process.env.MIRROR_PRIVATE_REPOSITORIES;
if(mirrorPrivateRepositories === 'true' && !githubToken){
const mirrorPrivateRepositories = ['1', 'true'].includes(process.env.MIRROR_PRIVATE_REPOSITORIES)
if(mirrorPrivateRepositories && !githubToken){
console.error('MIRROR_PRIVATE_REPOSITORIES was set to true but no GITHUB_TOKEN was specified, please specify! Exiting..')
return;
}