実行されているプログラムが CI で動いているのかどうかを判定する
https://github.com/watson/ci-info を使うと便利。
様々な CI サービスがそれぞれ使っている環境変数とかを見て自分が CI にいるのか否かを判定してくれる。
var ci = require('ci-info')
if (ci.isCI) {
console.log('The name of the CI server is:', ci.name)
} else {
console.log('This program is not running on a CI server')
}
https://sosukesuzuki.dev/posts/transfer-my-repo-to-oss-org/ とかで紹介した https://prettier/prettier-regression-testing は基本的に GitHub Actions で動かすことを想定しているが CLI からも叩くことができるようにしたかったのでその分岐のために使った。
あと Prettier 本体でも使ってる。
Author And Source
この問題について(実行されているプログラムが CI で動いているのかどうかを判定する), 我々は、より多くの情報をここで見つけました https://qiita.com/sosukesuzuki/items/8bb709c7f3b89eb363f4著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .