Comparing version 2.6.0 to 3.0.0
43
index.js
'use strict'; | ||
const process = require('process'); | ||
const git = require('./lib/git'); | ||
const git = require('./services/git'); | ||
const services = { | ||
appveyor: require('./lib/appveyor'), | ||
bamboo: require('./lib/bamboo'), | ||
bitbucket: require('./lib/bitbucket'), | ||
bitrise: require('./lib/bitrise'), | ||
buddy: require('./lib/buddy'), | ||
buildkite: require('./lib/buildkite'), | ||
circleci: require('./lib/circleci'), | ||
cirrus: require('./lib/cirrus'), | ||
codebuild: require('./lib/codebuild'), | ||
codeship: require('./lib/codeship'), | ||
drone: require('./lib/drone'), | ||
gitlab: require('./lib/gitlab'), | ||
jenkins: require('./lib/jenkins'), | ||
sail: require('./lib/sail'), | ||
semaphore: require('./lib/semaphore'), | ||
shippable: require('./lib/shippable'), | ||
teamcity: require('./lib/teamcity'), | ||
travis: require('./lib/travis'), | ||
vsts: require('./lib/vsts'), | ||
wercker: require('./lib/wercker'), | ||
appveyor: require('./services/appveyor'), | ||
bamboo: require('./services/bamboo'), | ||
bitbucket: require('./services/bitbucket'), | ||
bitrise: require('./services/bitrise'), | ||
buddy: require('./services/buddy'), | ||
buildkite: require('./services/buildkite'), | ||
circleci: require('./services/circleci'), | ||
cirrus: require('./services/cirrus'), | ||
codebuild: require('./services/codebuild'), | ||
codefresh: require('./services/codefresh'), | ||
codeship: require('./services/codeship'), | ||
drone: require('./services/drone'), | ||
gitlab: require('./services/gitlab'), | ||
jenkins: require('./services/jenkins'), | ||
sail: require('./services/sail'), | ||
semaphore: require('./services/semaphore'), | ||
shippable: require('./services/shippable'), | ||
teamcity: require('./services/teamcity'), | ||
travis: require('./services/travis'), | ||
vsts: require('./services/vsts'), | ||
wercker: require('./services/wercker'), | ||
}; | ||
@@ -28,0 +29,0 @@ |
const execa = require('execa'); | ||
function configuration(options) { | ||
return { | ||
commit: head(options), | ||
branch: branch(options), | ||
}; | ||
} | ||
function head(options) { | ||
@@ -36,2 +29,2 @@ try { | ||
module.exports = {configuration, head, branch}; | ||
module.exports = {head, branch}; |
{ | ||
"name": "env-ci", | ||
"description": "Get environment variables exposed by CI services", | ||
"version": "2.6.0", | ||
"version": "3.0.0", | ||
"author": "Pierre Vanduynslager (https://github.com/pvdlg)", | ||
@@ -27,4 +27,5 @@ "bugs": { | ||
"files": [ | ||
"index.js", | ||
"lib", | ||
"index.js" | ||
"services" | ||
], | ||
@@ -43,2 +44,3 @@ "homepage": "https://github.com/pvdlg/env-ci#readme", | ||
"codebuild", | ||
"codefresh", | ||
"codeship", | ||
@@ -45,0 +47,0 @@ "drone", |
132
README.md
@@ -22,9 +22,11 @@ # env-ci | ||
const {name, service, isCi, branch, commit, tag, build, buildUrl, job, jobUrl, isPr, pr, slug, root} = envCi(); | ||
const {name, service, isCi, branch, commit, tag, build, buildUrl, job, jobUrl, isPr, pr, prBranch, slug, root} = envCi(); | ||
if (isCI) { | ||
console.log(`Building branch ${branch} of repo ${slug} on ${name}`); | ||
console.log(`Building repo ${slug} on ${name} service`); | ||
if (isPr) { | ||
console.log(`Building Pull Request #${pr}`); | ||
console.log(`Building Pull Request #${pr} originating from branch ${prBranch} and targeting branch ${branch}`); | ||
} else { | ||
console.log(`Building branch ${branch}`); | ||
} | ||
@@ -40,48 +42,56 @@ | ||
| Variable | Description | | ||
|------------|-----------------------------------------------------------------------------------| | ||
| `name` | CI service Commercial name (e.g. `Travis CI`, `CircleCI`, `GitLab CI/CD`) | | ||
| `service` | Standardized CI service name (e.g. `travis`, `circleci`, `gitlab`) | | ||
| `isCi` | `true` is running on a CI, `false` otherwise | | ||
| `branch` | Git branch being built or targeted by a pull request | | ||
| `commit` | Commit sha that triggered the CI build | | ||
| `tag` | Git tag that triggered the CI build | | ||
| `build` | CI service build number | | ||
| `buildUrl` | Link to the CI service build | | ||
| `job` | CI service job number | | ||
| `jobUrl` | Link to the CI service job | | ||
| `isPr` | `true` is the build has been triggered by a Pull Request, `false` otherwise | | ||
| `pr` | Pull Request number | | ||
| `slug` | The slug (in form: owner_name/repo_name) of the repository currently being built | | ||
| `root` | The path to the directory where the repository is being built | | ||
| Variable | Description | | ||
|------------|--------------------------------------------------------------------------------------------------------| | ||
| `name` | CI service Commercial name (e.g. `Travis CI`, `CircleCI`, `GitLab CI/CD`) | | ||
| `service` | Standardized CI service name (e.g. `travis`, `circleci`, `gitlab`) | | ||
| `isCi` | `true` is running on a CI, `false` otherwise | | ||
| `branch` | Git branch being built or targeted by a Pull Request | | ||
| `commit` | Commit sha that triggered the CI build | | ||
| `tag` | Git tag that triggered the CI build | | ||
| `build` | CI service build number | | ||
| `buildUrl` | Link to the CI service build | | ||
| `job` | CI service job number | | ||
| `jobUrl` | Link to the CI service job | | ||
| `isPr` | `true` if the build has been triggered by a Pull Request, `false` otherwise | | ||
| `pr` | Pull Request number (only for builds triggered by a Pull Request) | | ||
| `prBranch` | Git branch branch from which the Pull Request originated (only for builds triggered by a Pull Request) | | ||
| `slug` | The slug (in form: owner_name/repo_name) of the repository currently being built | | ||
| `root` | The path to the directory where the repository is being built | | ||
**Note**: Some variables can be detected only on certain CI services. See [Supported CI](#supported-ci). | ||
**Note**: The `pr` and `prBranch` properties are only available for builds triggered when a Pull Request is opened/updated and not on builds triggered by a push on a branch even if that branch happens to be the branch from which the Pull Request originated. | ||
## Supported CI | ||
| CI Service (`name`) | `service` | `isCi` | `branch` | `commit` | `tag` | `build` | `buildUrl` | `job` | `jobUrl` | `isPr` | `pr` | `slug` | `root` | | ||
|----------------------------------------------------------------------------------------------------------------------------------------|:-----------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:| | ||
| [AppVeyor]( https://www.appveyor.com/docs/environment-variables) | `appveyor` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [Bamboo](https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html) | `bamboo` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :white_check_mark: | | ||
| [Bitbucket](https://confluence.atlassian.com/bitbucket/environment-variables-794502608.html) | `bitbucket` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | | ||
| [Bitrise](https://devcenter.bitrise.io/builds/available-environment-variables/#exposed-by-bitriseio) | `bitrise` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | | ||
| [Buddy](https://buddy.works/knowledge/deployments/how-use-environment-variables#default-environment-variables) | `buddy` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | | ||
| [Buildkite](https://buildkite.com/docs/builds/environment-variables) | `buildkite` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [CircleCI](https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables) | `circleci` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | | ||
| [Cirrus CI](https://cirrus-ci.org/guide/writing-tasks/#environment-variables) | `cirrus` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [AWS CodeBuild](https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html) | `codebuild` | :white_check_mark: | :warning: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | | ||
| [Codeship](https://documentation.codeship.com/basic/builds-and-configuration/set-environment-variables/#default-environment-variables) | `codeship` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :white_check_mark: | :x: | | ||
| [Drone](https://readme.drone.io/reference/environ/) | `drone` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | | ||
| [Gitlab CI/CD](https://docs.gitlab.com/ce/ci/variables/README.html) | `gitlab` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | | ||
| [Jenkins](https://wiki.jenkins.io/display/JENKINS/Building+a+software+project) | `jenkins` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | | ||
| [Sail CI](https://sail.ci/docs/environment-variables) | `sail` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [Semaphore](https://semaphoreci.com/docs/available-environment-variables.html) | `semaphore` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [Shippable](http://docs.shippable.com/ci/env-vars/#stdEnv) | `shippable` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [TeamCity](https://confluence.jetbrains.com/display/TCD10/Predefined+Build+Parameters) | `teamcity` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | | ||
| [Travis CI](https://docs.travis-ci.com/user/environment-variables#default-environment-variables) | `travis` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [Visual Studio Team Services](https://docs.microsoft.com/en-us/vsts/pipelines/build/variables) | `vsts` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | | ||
| [Wercker](http://devcenter.wercker.com/docs/environment-variables/available-env-vars#hs_cos_wrapper_name) | `wercker` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | | ||
| CI Service (`name`) | `service` | `isCi` | `branch` | `commit` | `tag` | `build` | `buildUrl` | `job` | `jobUrl` | `isPr` | `pr` | `prBranch` | `slug` | `root` | | ||
|----------------------------------------------------------------------------------------------------------------------------------------|:-----------:|:------------------:|:---------------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:---------------------:|:---------------------:|:---------------------:|:------------------:|:------------------:| | ||
| [AppVeyor]( https://www.appveyor.com/docs/environment-variables) | `appveyor` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [Bamboo](https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html) | `bamboo` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | | :x: | :white_check_mark: | | ||
| [Bitbucket](https://confluence.atlassian.com/bitbucket/environment-variables-794502608.html) | `bitbucket` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | | :white_check_mark: | :white_check_mark: | | ||
| [Bitrise](https://devcenter.bitrise.io/builds/available-environment-variables/#exposed-by-bitriseio) | `bitrise` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | | ||
| [Buddy](https://buddy.works/knowledge/deployments/how-use-environment-variables#default-environment-variables) | `buddy` | :white_check_mark: | [:warning:](#buddy) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | | ||
| [Buildkite](https://buildkite.com/docs/builds/environment-variables) | `buildkite` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [CircleCI](https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables) | `circleci` | :white_check_mark: | [:warning:](#circleci) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | | ||
| [Cirrus CI](https://cirrus-ci.org/guide/writing-tasks/#environment-variables) | `cirrus` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [AWS CodeBuild](https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html) | `codebuild` | :white_check_mark: | [:warning:](#aws-codebuild) | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | | ||
| [Codefresh](https://codefresh.io/docs/docs/codefresh-yaml/variables#system-provided-variables) | `codefresh` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [Codeship](https://documentation.codeship.com/basic/builds-and-configuration/set-environment-variables/#default-environment-variables) | `codeship` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :x: | | ||
| [Drone](https://readme.drone.io/reference/environ/) | `drone` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | | ||
| [Gitlab CI/CD](https://docs.gitlab.com/ce/ci/variables/README.html) | `gitlab` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | | ||
| [Jenkins](https://wiki.jenkins.io/display/JENKINS/Building+a+software+project) | `jenkins` | :white_check_mark: | [:warning:](#jenkins) | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | [:warning:](#jenkins) | [:warning:](#jenkins) | [:warning:](#jenkins) | :white_check_mark: | :white_check_mark: | | ||
| [Sail CI](https://sail.ci/docs/environment-variables) | `sail` | :white_check_mark: | [:warning:](#sail) | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | | ||
| [Semaphore](https://semaphoreci.com/docs/available-environment-variables.html) | `semaphore` | :white_check_mark: | [:warning:](#semaphore) | :white_check_mark: | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [Shippable](http://docs.shippable.com/ci/env-vars/#stdEnv) | `shippable` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [TeamCity](https://confluence.jetbrains.com/display/TCD10/Predefined+Build+Parameters) | `teamcity` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | | ||
| [Travis CI](https://docs.travis-ci.com/user/environment-variables#default-environment-variables) | `travis` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ||
| [Visual Studio Team Services](https://docs.microsoft.com/en-us/vsts/pipelines/build/variables) | `vsts` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | | ||
| [Wercker](http://devcenter.wercker.com/docs/environment-variables/available-env-vars#hs_cos_wrapper_name) | `wercker` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | | ||
**Note**: If none of the above CI services is detected, `commit` and `branch` are determined based on the local Git repository, and `isCi` is determined based on the `CI` environment variable. | ||
:warning: See [Caveats](#caveats) | ||
**Note**: Unsupported properties will always be `undefined`. For example if a Ci services doesn't support triggering builds when a Pull Request is opened/updated, `isPr` will be `undefined`. | ||
**Note**: If none of the above CI services is detected, `commit` and `branch` are determined based on the local Git repository, and `isCi` is determined based on the `CI` environment variable. | ||
## API | ||
@@ -115,14 +125,36 @@ | ||
## Caveats :warning: | ||
## Caveats | ||
### Git `branch` determination | ||
### AWS CodeBuild | ||
Certain CI services don't provide an environment variable to determine the current Git branch being built. | ||
In such cases the branch is determined with the command `git rev-parse --abbrev-ref HEAD`. | ||
AWS CodeBuild doesn't provide an environment variable to determine the current Git branch being built. In addition, it clones the repository in a [detached head state](https://git-scm.com/docs/git-checkout#_detached_head) so the branch cannot be determined with `git rev-parse --abbrev-ref HEAD`. | ||
To work around this limitation, `env-ci` look for the remote branches having the same `HEAD` as the local detached `HEAD` to determine the branch from which the detached `HEAD` was created. | ||
In the rare case where there is multiple remote branches with the same `HEAD` as the local detached `HEAD`, `env-ci` will arbitrarily pick the first one. This can lead to an inaccurate `branch` value in such circumstances. | ||
However, if the local repository is in a [detached head state](https://git-scm.com/docs/git-checkout#_detached_head) the branch cannot be determined directly. In such case, `env-ci` will look for the remote branches having the same HEAD as the local detached HEAD to determine the branch from which the detached HEAD was created. | ||
### Buddy | ||
In the rare case where there is multiple remote branches with the same HEAD as the local detached HEAD, `env-ci` will arbitrarily pick the first one. This can lead to an inaccurate `branch` value for certain CI services in such circumstances. | ||
For builds triggered when [a Pull Request is opened/updated](https://buddy.works/knowledge/deployments/pull-requests), Buddy doesn't provide an environment variable indicating the branch from which the Pull Request originated nor the target branch. It also build from a branch named `pull/<PR number>` so the target branch cannot be determined with a `git` command. | ||
Therefore in the case of Pull Request builds, `env-ci` will not be able to determine the `branch` and `prBranch` properties. | ||
Affected CI services: | ||
- [AWS CodeBuild](https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html) | ||
See [feature request](https://forum.buddy.works/t/determine-pull-request-branch-with-environment-variable/911). | ||
### CircleCI | ||
For builds triggered when a Pull Request is opened/updated, CircleCI doesn't provide an environment variable indicating the target branch. | ||
Therefore in the case of Pull Request builds, `env-ci` will not be able to determine the `branch` property. However `prBranch` will be set. | ||
See [feature request](https://discuss.circleci.com/t/create-a-circle-target-branch-envar/10022). | ||
## Jenkins | ||
Triggering build when a Pull Request is opened/updated is supported only via the [ghprb-plugin](https://github.com/jenkinsci/ghprb-plugin) and [gitlab-plugin](https://github.com/jenkinsci/gitlab-plugin). Therefore `env-ci` will set `isPr`, `pr` and `prBranch` and define `branch` with the Pull Request target branch only if one those plugin is used. | ||
## Sail | ||
For builds triggered when a Pull Request is opened/updated, Sail doesn't provide an environment variable indicating the target branch, and the one for the current branch is set to `pull/<PR number>` independently of the the branch name from which the Pull Request originated. | ||
Therefore in the case of Pull Request builds, `env-ci` will not be able to determine the `branch` and `prBranch` properties. | ||
## Semaphore | ||
For builds triggered when a Pull Request is opened/updated, Semaphore doesn't provide an environment variable indicating the target branch. | ||
Therefore in the case of Pull Request builds, `env-ci` will not be able to determine the `branch` property. However `prBranch` will be set. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36150
28
545
158
1