Update github API

pull/13/head
MaksimZhukov 4 years ago
parent 347402ff31
commit ebc70e779a

@ -84,7 +84,7 @@ Git-CommitAllChanges -Message $CommitMessage
Write-Host "Push branch: $BranchName" Write-Host "Push branch: $BranchName"
Git-PushBranch -Name $BranchName -Force $true Git-PushBranch -Name $BranchName -Force $true
$gitHubApi = Get-GitHubApi -RepositoryName $RepositoryFullName -AccessToken $AccessToken $gitHubApi = Get-GitHubApi -RepositoryFullName $RepositoryFullName -AccessToken $AccessToken
$repositoryOwner = $RepositoryFullName.Split('/')[0] $repositoryOwner = $RepositoryFullName.Split('/')[0]
$pullRequest = $gitHubApi.GetPullRequest($BranchName, $repositoryOwner) $pullRequest = $gitHubApi.GetPullRequest($BranchName, $repositoryOwner)

@ -145,19 +145,17 @@ class GitHubApi
function Get-GitHubApi { function Get-GitHubApi {
param ( param (
[Parameter(ParameterSetName = 'RepositoryOwner')] [Parameter(ParameterSetName = 'RepositorySingle')]
[Parameter(ParameterSetName = 'RepositoryName')] [string] $RepositoryFullName,
[Parameter(ParameterSetName = 'RepositorySplitted')]
[string] $RepositoryOwner, [string] $RepositoryOwner,
[Parameter(ParameterSetName = 'RepositorySplitted')]
[Parameter(ParameterSetName = 'RepositoryName')]
[string] $RepositoryName, [string] $RepositoryName,
[string] $AccessToken [string] $AccessToken
) )
# Split repository name (like 'actions/versions-package-tools') in case when owner is not set if ($PSCmdlet.ParameterSetName -eq "RepositorySingle") {
if (-not $RepositoryOwner) { $RepositoryOwner, $RepositoryName = $Repository.Split('/', 2)
$RepositoryOwner = $RepositoryName.Split('/')[0]
} }
return [GitHubApi]::New($RepositoryOwner, $RepositoryName, $AccessToken) return [GitHubApi]::New($RepositoryOwner, $RepositoryName, $AccessToken)

@ -81,7 +81,7 @@ function Queue-Builds {
} }
} }
$gitHubApi = Get-GitHubApi -RepositoryName $RepositoryFullName -AccessToken $AccessToken $gitHubApi = Get-GitHubApi -RepositoryFullName $RepositoryFullName -AccessToken $AccessToken
Write-Host "Versions to build: $ToolVersions" Write-Host "Versions to build: $ToolVersions"
Queue-Builds -GitHubApi $gitHubApi ` Queue-Builds -GitHubApi $gitHubApi `

@ -25,7 +25,7 @@ Import-Module (Join-Path $PSScriptRoot "manifest-utils.psm1") -Force
$configuration = Read-ConfigurationFile -Filepath $ConfigurationFile $configuration = Read-ConfigurationFile -Filepath $ConfigurationFile
$gitHubApi = Get-GitHubApi -RepositoryName $RepositoryFullName -AccessToken $GitHubAccessToken $gitHubApi = Get-GitHubApi -RepositoryFullName $RepositoryFullName -AccessToken $GitHubAccessToken
$releases = $gitHubApi.GetReleases() $releases = $gitHubApi.GetReleases()
$versionIndex = Build-VersionsManifest -Releases $releases -Configuration $configuration $versionIndex = Build-VersionsManifest -Releases $releases -Configuration $configuration
$versionIndex | ConvertTo-Json -Depth 5 | Out-File $OutputFile -Encoding UTF8NoBOM -Force $versionIndex | ConvertTo-Json -Depth 5 | Out-File $OutputFile -Encoding UTF8NoBOM -Force

Loading…
Cancel
Save