git-docker/windows/clone-pull-request.ps1

17 lines
396 B
PowerShell
Raw Normal View History

2018-09-11 18:06:54 +00:00
Set-Variable -Name "FLAGS" -Value ""
if ($Env:PLUGIN_DEPTH) {
2019-04-18 18:57:37 +00:00
Set-Variable -Name "FLAGS" -Value "--depth=$Env:PLUGIN_DEPTH"
2018-09-11 18:06:54 +00:00
}
if (!(Test-Path .git)) {
git init
git remote add origin $Env:DRONE_REMOTE_URL
}
git fetch $FLAGS origin "+refs/heads/${Env:DRONE_COMMIT_BRANCH}:"
git checkout $Env:DRONE_COMMIT_BRANCH
2019-04-18 18:57:37 +00:00
git fetch origin "${Env:DRONE_COMMIT_REF}:"
git merge $Env:DRONE_COMMIT_SHA