run-teamcity-tests/Handle-PullRequestComment.ps1

27 lines
923 B
PowerShell
Raw Normal View History

2024-10-23 22:09:19 +10:00
param(
[Parameter(Mandatory=$true)] [string] $teamCityToken,
[Parameter(Mandatory=$true)] [string] $giteaToken,
[Parameter(Mandatory=$true)] [string] $pullId
)
$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
# Получим инфо о пулл-реквесте
2024-10-23 22:09:19 +10:00
$pull = Invoke-RestMethod -Uri https://sc.lers.ru/api/v1/repos/lers/LersUchet/pulls/$pullId -Headers @{Authorization = "token $giteaToken"}
2024-10-23 22:09:19 +10:00
$branch = $pull.head.ref
Write-Output "Starting tests in $branch"
2024-10-23 22:09:19 +10:00
& $scriptDir/Run-TeamCityBuild.ps1 -token $teamCityToken -branch $branch -buildId "LU_FullTests"
& $scriptDir/Run-TeamCityBuild.ps1 -token $teamCityToken -branch $branch -buildId "LU_ReleaseBuild"
2024-10-23 22:09:19 +10:00
$webLabel = $pull.labels | Where-Object { $_.name -eq "comp/Web" }
if ($webLabel)
{
Write-Host "Running web tests"
& $scriptDir/Run-TeamCityBuild.ps1 -token $teamCityToken -branch $branch -buildId "LU_Tests_WebTests"
}