0
0

More than 3 years have passed since last update.

実行されているプログラムが CI で動いているのかどうかを判定する

Posted at

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 本体でも使ってる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0