Comparing version 5.0.1 to 5.0.2
@@ -5,2 +5,6 @@ function prNumber(pr) { | ||
module.exports = {prNumber}; | ||
function parseBranch(branch) { | ||
return branch ? /^(?:refs\/heads\/)?(?<branch>.+)$/i.exec(branch)[1] : undefined; | ||
} | ||
module.exports = {prNumber, parseBranch}; |
{ | ||
"name": "env-ci", | ||
"description": "Get environment variables exposed by CI services", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"author": "Pierre Vanduynslager (https://github.com/pvdlg)", | ||
@@ -9,5 +9,2 @@ "ava": { | ||
"test/**/*.test.js" | ||
], | ||
"helpers": [ | ||
"test/helpers/**/*" | ||
] | ||
@@ -23,3 +20,3 @@ }, | ||
"devDependencies": { | ||
"ava": "^2.0.0", | ||
"ava": "^3.1.0", | ||
"codecov": "^3.0.0", | ||
@@ -29,5 +26,5 @@ "file-url": "^3.0.0", | ||
"proxyquire": "^2.1.0", | ||
"semantic-release": "^16.0.0", | ||
"tempy": "^0.3.0", | ||
"xo": "^0.25.0" | ||
"semantic-release": "^17.0.0", | ||
"tempy": "^0.5.0", | ||
"xo": "^0.27.0" | ||
}, | ||
@@ -34,0 +31,0 @@ "engines": { |
// https://help.github.com/en/articles/virtual-environments-for-github-actions#environment-variables | ||
const {parseBranch} = require('../lib/utils'); | ||
const parseBranch = branch => (/^(?:refs\/heads\/)?(?<branch>.+)$/i.exec(branch) || [])[1]; | ||
const getPrEvent = ({env}) => { | ||
@@ -6,0 +5,0 @@ try { |
// https://docs.microsoft.com/en-us/vsts/pipelines/build/variables | ||
// The docs indicate that SYSTEM_PULLREQUEST_SOURCEBRANCH and SYSTEM_PULLREQUEST_TARGETBRANCH are in the long format (e.g `refs/heads/master`) however tests show they are both in the short format (e.g. `master`) | ||
const {parseBranch} = require('../lib/utils'); | ||
@@ -17,6 +18,6 @@ module.exports = { | ||
build: env.BUILD_BUILDNUMBER, | ||
branch: isPr ? env.SYSTEM_PULLREQUEST_TARGETBRANCH : env.BUILD_SOURCEBRANCHNAME, | ||
branch: parseBranch(isPr ? env.SYSTEM_PULLREQUEST_TARGETBRANCH : env.BUILD_SOURCEBRANCH), | ||
pr, | ||
isPr, | ||
prBranch: isPr ? env.SYSTEM_PULLREQUEST_SOURCEBRANCH : undefined, | ||
prBranch: parseBranch(isPr ? env.SYSTEM_PULLREQUEST_SOURCEBRANCH : undefined), | ||
root: env.BUILD_REPOSITORY_LOCALPATH, | ||
@@ -23,0 +24,0 @@ }; |
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
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
41545
645