-
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
3 changed files
with
40 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,35 @@ | ||
const gitHelpers = require('../lib/git-helpers') | ||
|
||
const env = process.env | ||
|
||
/** | ||
* In order for this to work with Team City, the build configuration needs to set | ||
* the following environment variables: | ||
* | ||
* - VCS_ROOT_URL from the vcsroot.<vcsrootid>.url parameter | ||
* - VCS_ROOT_BRANCH from the teamcity.build.branch parameter | ||
*/ | ||
|
||
/** | ||
* Is the current branch a pull request | ||
*/ | ||
function isPullRequest () { | ||
return /.+\/merge|head/.test(env.VCS_ROOT_BRANCH) | ||
} | ||
|
||
/** | ||
* Should the lockfile be uploaded | ||
*/ | ||
function shouldUpload () { | ||
const re = /^(chore|fix)\(package\): update lockfile|([^ ]+ to version).*$/mi | ||
const lastCommitMessage = gitHelpers.getLastCommitMessage() | ||
return re.test(lastCommitMessage) | ||
} | ||
|
||
module.exports = { | ||
repoSlug: gitHelpers.getRepoSlug(env.VCS_ROOT_URL), | ||
branchName: env.VCS_ROOT_BRANCH, | ||
firstPush: shouldUpload(), | ||
correctBuild: !isPullRequest(), | ||
uploadBuild: shouldUpload() | ||
} |
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
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