-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const gitHelpers = require('../lib/git-helpers') | ||
|
||
const env = process.env | ||
|
||
// http://devcenter.bitrise.io/faq/available-environment-variables/ | ||
|
||
function parseRepoSlug(repoUrl) { | ||
const repoUrlWithoutGitExtension = repoUrl.replace('.git', '') | ||
const lastSegmentOfRepoUrl = repoUrlWithoutGitExtension.split(':').pop() // split at protocoll eg. git://... or git@github.com:... and only retain the relevant last segment | ||
const splitAtSlash = lastSegmentOfRepoUrl.split('/') | ||
const repoName = splitAtSlash.pop() | ||
const repoOwner = splitAtSlash.pop() | ||
|
||
return `${repoOwner}/${repoName}` | ||
} | ||
|
||
module.exports = { | ||
// The GitHub repo slug | ||
repoSlug: parseRepoSlug(env.GIT_REPOSITORY_URL), | ||
// The name of the current branch | ||
branchName: env.BITRISE_GIT_BRANCH, | ||
// Is this the first push on this branch | ||
// i.e. the Greenkeeper commit | ||
firstPush: gitHelpers.getNumberOfCommitsOnBranch(env.BITRISE_GIT_BRANCH) === 1, | ||
// Is this a regular build | ||
correctBuild: env.PR === 'false', | ||
// Should the lockfile be uploaded from this build | ||
uploadBuild: true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters