Update repos send PRs
This commit is contained in:
parent
4d8c21c219
commit
1593966f3b
|
|
@ -31,6 +31,7 @@ param(
|
||||||
[switch]$NoPush,
|
[switch]$NoPush,
|
||||||
[string]$GitAuthorName = $null,
|
[string]$GitAuthorName = $null,
|
||||||
[string]$GitAuthorEmail = $null,
|
[string]$GitAuthorEmail = $null,
|
||||||
|
[string]$GithubToken = $null,
|
||||||
[switch]$Force,
|
[switch]$Force,
|
||||||
[string[]]$GitCommitArgs = @()
|
[string[]]$GitCommitArgs = @()
|
||||||
)
|
)
|
||||||
|
|
@ -43,14 +44,7 @@ Import-Module "$PSScriptRoot/common.psm1" -Scope Local -Force
|
||||||
$RepoRoot = Resolve-Path "$PSScriptRoot\.."
|
$RepoRoot = Resolve-Path "$PSScriptRoot\.."
|
||||||
$ModuleDirectory = Join-Path $RepoRoot "modules"
|
$ModuleDirectory = Join-Path $RepoRoot "modules"
|
||||||
|
|
||||||
$gitConfigArgs = @()
|
Set-GitHubInfo $GithubToken $GitAuthorName $GitAuthorEmail
|
||||||
if ($GitAuthorName) {
|
|
||||||
$gitConfigArgs += '-c', "user.name=$GitAuthorName"
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($GitAuthorEmail) {
|
|
||||||
$gitConfigArgs += '-c', "user.email=$GitAuthorEmail"
|
|
||||||
}
|
|
||||||
|
|
||||||
Push-Location $ModuleDirectory
|
Push-Location $ModuleDirectory
|
||||||
try {
|
try {
|
||||||
|
|
@ -79,12 +73,13 @@ try {
|
||||||
Write-Verbose "About to update dependencies.props for $($submodule.module)"
|
Write-Verbose "About to update dependencies.props for $($submodule.module)"
|
||||||
& .\run.ps1 upgrade deps --source $Source --id $LineupID --version $LineupVersion --deps-file $depsFile
|
& .\run.ps1 upgrade deps --source $Source --id $LineupID --version $LineupVersion --deps-file $depsFile
|
||||||
|
|
||||||
Invoke-Block { & git @gitConfigArgs add $depsFile $koreBuildLock }
|
Invoke-Block { & git add $depsFile $koreBuildLock }
|
||||||
|
|
||||||
# If there were any changes test and push.
|
# If there were any changes test and push.
|
||||||
& git diff --cached --quiet ./
|
& git diff --cached --quiet ./
|
||||||
|
$msgBody = "Update dependencies.props`n`n[auto-updated: dependencies]"
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
Invoke-Block { & git @gitConfigArgs commit --quiet -m "Update dependencies.props`n`n[auto-updated: dependencies]" @GitCommitArgs }
|
Invoke-Block { & git commit --quiet -m $msgBody @GitCommitArgs }
|
||||||
|
|
||||||
# Prepare this submodule for push
|
# Prepare this submodule for push
|
||||||
$sshUrl = "git@github.com:aspnet/$($submodule.module)"
|
$sshUrl = "git@github.com:aspnet/$($submodule.module)"
|
||||||
|
|
@ -105,8 +100,10 @@ try {
|
||||||
|
|
||||||
# Push the changes
|
# Push the changes
|
||||||
if (-not $NoPush -and ($Force -or ($PSCmdlet.ShouldContinue("Pushing updates to repos.", 'Push the changes to these repos?')))) {
|
if (-not $NoPush -and ($Force -or ($PSCmdlet.ShouldContinue("Pushing updates to repos.", 'Push the changes to these repos?')))) {
|
||||||
|
$baseBranch = $submodule.branch
|
||||||
|
$upgradeBranch = "$baseBranch/upgrade-deps"
|
||||||
try {
|
try {
|
||||||
Invoke-Block { & git @gitConfigArgs push origin HEAD:$($submodule.branch)}
|
CreatePR "aspnet" $GithubUsername $baseBranch $upgradeBranch $msgBody $GithubToken
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Warning "Error in pushing $($submodule.module): $_"
|
Write-Warning "Error in pushing $($submodule.module): $_"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue