mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
[All OS] Output full version of git to software report (#5097)
This commit is contained in:
@@ -89,8 +89,7 @@ function Get-DockerBuildxVersion {
|
||||
}
|
||||
|
||||
function Get-GitVersion {
|
||||
$result = Get-CommandResult "git --version"
|
||||
$gitVersion = $result.Output | Take-OutputPart -Part 2
|
||||
$gitVersion = git --version | Take-OutputPart -Part -1
|
||||
$aptSourceRepo = Get-AptSourceRepository -PackageName "git-core"
|
||||
return "Git $gitVersion (apt source repository: $aptSourceRepo)"
|
||||
}
|
||||
|
||||
@@ -266,8 +266,8 @@ function Get-CurlVersion {
|
||||
}
|
||||
|
||||
function Get-GitVersion {
|
||||
$gitVersion = Run-Command "git --version" | Take-Part -Part 2
|
||||
return "Git: $gitVersion"
|
||||
$gitVersion = Run-Command "git --version" | Take-Part -Part -1
|
||||
return "Git $gitVersion"
|
||||
}
|
||||
|
||||
function Get-GitLFSVersion {
|
||||
|
||||
@@ -161,3 +161,15 @@ function Test-BlankElement {
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
function Take-Part {
|
||||
param (
|
||||
[Parameter(ValueFromPipeline)]
|
||||
[string] $toolOutput,
|
||||
[string] $Delimiter = " ",
|
||||
[int[]] $Part
|
||||
)
|
||||
$parts = $toolOutput.Split($Delimiter, [System.StringSplitOptions]::RemoveEmptyEntries)
|
||||
$selectedParts = $parts[$Part]
|
||||
return [string]::Join($Delimiter, $selectedParts)
|
||||
}
|
||||
@@ -67,8 +67,7 @@ function Get-DockerWincredVersion {
|
||||
}
|
||||
|
||||
function Get-GitVersion {
|
||||
$(git version) -match "git version (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$gitVersion = $Matches.Version
|
||||
$gitVersion = git --version | Take-Part -Part -1
|
||||
return "Git $gitVersion"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user