#!/usr/bin/env node /** Returns true if current environment is running inside CI. Otherwise returns false. */ function insideCi() { // Bail out if this is specifically overwritten to false. // Some users seem to wanna be able to do that if (process.env.CI === 'false') return false // Most CI use env.CI (travis, Gitlab, etc.) // There are some exceptions though: // CI_APP_ID is used by Appflow: https://ionic.io/docs/appflow/package/environments#predefined-environments // CI_NAME is used by Codeship:https://docs.cloudbees.com/docs/cloudbees-codeship/latest/pro-builds-and-configuration/environment-variables // BUILD_NUMBER is used by TeamCity: https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html#Predefined+Server+Build+Parameters // RUN_ID is used by Taskcluster: https://docs.taskcluster.net/docs/reference/workers/docker-worker/environment return Boolean(['CI','CI_APP_ID','BUILD_NUMBER','CI_NAME','RUN_ID'].some(x => process.env[x])) } module.exports.insideCi = insideCi if (require.main === module) { process.exit(insideCi() ? 0 : 1) }