Skip to content

Commit 19d9509

Browse files
Robert Holtrjmholt
Robert Holt
authored andcommitted
Fix branch usage
1 parent 5f92667 commit 19d9509

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

tools/GitHubTools.psm1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,12 @@ function Copy-GitRepository
290290

291291
Write-Verbose "Cloning git repository '$OriginRemote' to path '$Destination'"
292292

293-
Exec { git clone --single-branch --branch $CloneBranch $OriginRemote $Destination }
293+
if ($CloneBranch)
294+
{
295+
Write-Verbose "Cloned branch: $CloneBranch"
296+
}
297+
298+
Exec { git clone $OriginRemote --branch $CloneBranch --single-branch $Destination }
294299

295300
Push-Location $Destination
296301
try

tools/changelog/updateChangelog.ps1

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
using module ..\GitHubTools.psm1
77
using module ..\ChangelogTools.psm1
88

9+
<#
10+
.EXAMPLE
11+
.\updateChangelog.ps1 -GitHubToken $ghTok -PSExtensionSinceRef v2.0.0-preview.3 -PsesSinceRef v2.0.0-preview.3 -PSExtensionVersion 2019.5.0 -PsesVersion 1.12.2 -PSExtensionUntilRef legacy/1.x -PsesUntilRef legacy/1.x -Verbose
12+
#>
913
[CmdletBinding()]
1014
param(
1115
[Parameter(Mandatory)]
@@ -44,6 +48,14 @@ param(
4448
[string]
4549
$PsesUntilRef = 'HEAD',
4650

51+
[Parameter()]
52+
[string]
53+
$PSExtensionBaseBranch, # Default is master if HEAD, otherwise $PSExtensionSinceRef
54+
55+
[Parameter()]
56+
[string]
57+
$PsesBaseBranch, # Default is master if HEAD, otherwise $PsesSinceRef
58+
4759
[Parameter()]
4860
[string]
4961
$Organization = 'PowerShell',
@@ -98,6 +110,30 @@ if (-not $PsesReleaseName)
98110
$PsesReleaseName = "v$PsesVersion"
99111
}
100112

113+
if (-not $PSExtensionBaseBranch)
114+
{
115+
$PSExtensionBaseBranch = if ($PSExtensionUntilRef -eq 'HEAD')
116+
{
117+
'master'
118+
}
119+
else
120+
{
121+
$PSExtensionUntilRef
122+
}
123+
}
124+
125+
if (-not $PsesBaseBranch)
126+
{
127+
$PsesBaseBranch = if ($PsesUntilRef -eq 'HEAD')
128+
{
129+
'master'
130+
}
131+
else
132+
{
133+
$PsesUntilRef
134+
}
135+
}
136+
101137
function UpdateChangelogFile
102138
{
103139
param(
@@ -213,6 +249,7 @@ $cloneParams = @{
213249
OriginRemote = "https://github.com/$FromFork/$psesRepoName"
214250
Destination = $cloneLocation
215251
CheckoutBranch = $branchName
252+
CloneBranch = $PsesBaseBranch
216253
Clobber = $true
217254
Remotes = @{ 'upstream' = "https://github.com/$TargetFork/$vscodeRepoName" }
218255
}
@@ -241,7 +278,7 @@ $psextChangelogSection = Get-GitCommit @psExtGetCommitParams |
241278
Get-ChangeInfoFromCommit -GitHubToken $GitHubToken -Verbose:$VerbosePreference |
242279
Skip-IgnoredChange @ignore -Verbose:$VerbosePreference |
243280
New-ChangelogEntry @clEntryParams |
244-
New-ChangelogSection @clSectionParams -Preamble "#### [$vscodeRepoName](https://github.com/$Organization/$vscodeRepoName)" -Postamble $psesChangelogPostamble
281+
New-ChangelogSection @clSectionParams -Preamble "#### [$vscodeRepoName](https://github.com/$Organization/$vscodeRepoName)" -Postamble $psesChangelogPostamble -ReleaseName $PSExtensionReleaseName
245282

246283
Write-Host "vscode-PowerShell CHANGELOG:`n`n$psextChangelogSection`n`n"
247284

@@ -251,6 +288,7 @@ $cloneParams = @{
251288
OriginRemote = "https://github.com/$FromFork/$vscodeRepoName"
252289
Destination = $cloneLocation
253290
CheckoutBranch = $branchName
291+
CloneBranch = $PSExtensionBaseBranch
254292
Clobber = $true
255293
Remotes = @{ 'upstream' = "https://github.com/$TargetFork/$vscodeRepoName" }
256294
PullUpstream = $true
@@ -273,6 +311,7 @@ $prParams = @{
273311
Title = "Update CHANGELOG for $PsesReleaseName"
274312
GitHubToken = $GitHubToken
275313
FromOrg = $FromFork
314+
TargetBranch = $PsesBaseBranch
276315
}
277316
New-GitHubPR @prParams -Verbose:$VerbosePreference
278317

@@ -284,6 +323,7 @@ $prParams = @{
284323
Title = "Update $extensionName CHANGELOG for $PSExtensionReleaseName"
285324
GitHubToken = $GitHubToken
286325
FromOrg = $FromFork
326+
TargetBranch = $PSExtensionBaseBranch
287327
}
288328
New-GitHubPR @prParams -Verbose:$VerbosePreference
289329

0 commit comments

Comments
 (0)