inside-ci/index.js

13 lines
338 B
JavaScript
Raw Normal View History

2024-11-18 23:57:35 +00:00
#!/usr/bin/env node
module.exports.insideCi = function insideCi() {
2024-11-18 23:57:35 +00:00
// Bail out if this is specifically overwritten to false.
if (process.env.CI === 'false') return false
return !!['CI','CI_APP_ID','BUILD_NUMBER','CI_NAME','RUN_ID'].some(x => process.env[x])
2024-11-18 23:57:35 +00:00
}
if (require.main === module) {
process.exit(insideCi() ? 0 : 1)
}