Comparing version 5.4.0 to 5.4.1
{ | ||
"name": "env-ci", | ||
"description": "Get environment variables exposed by CI services", | ||
"version": "5.4.0", | ||
"version": "5.4.1", | ||
"author": "Pierre Vanduynslager (https://github.com/pvdlg)", | ||
@@ -26,3 +26,3 @@ "ava": { | ||
"tempy": "0.7.1", | ||
"xo": "0.45.0" | ||
"xo": "0.46.3" | ||
}, | ||
@@ -29,0 +29,0 @@ "engines": { |
@@ -21,2 +21,7 @@ // https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables | ||
const getPrNumber = (env) => { | ||
const event = env.GITHUB_EVENT_PATH ? require(env.GITHUB_EVENT_PATH) : undefined; | ||
return event && event.pull_request ? event.pull_request.number : undefined; | ||
}; | ||
module.exports = { | ||
@@ -28,3 +33,5 @@ detect({env}) { | ||
const isPr = env.GITHUB_EVENT_NAME === 'pull_request' || env.GITHUB_EVENT_NAME === 'pull_request_target'; | ||
const branch = parseBranch(env.GITHUB_REF); | ||
const branch = parseBranch( | ||
env.GITHUB_EVENT_NAME === 'pull_request_target' ? `refs/pull/${getPrNumber(env)}/merge` : env.GITHUB_REF | ||
); | ||
@@ -31,0 +38,0 @@ return { |
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
47231
716
3