mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-28 12:27:54 +08:00
resolve comments.
This commit is contained in:
@@ -12,20 +12,22 @@ function Validate-Scripts {
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$Pattern
|
||||
)
|
||||
$ScriptsWithBrokenShebang = @()
|
||||
$ScriptWithoutShebangLine = @()
|
||||
Get-ChildItem $path | ForEach-Object {
|
||||
if (Get-Content -Path $($_.FullName) | Select-Object -First 1 | Select-String -Pattern $Pattern -Quiet) {
|
||||
Write-Host "Pattern '$Pattern' found in '$($_.FullName)'"
|
||||
}
|
||||
else {
|
||||
Write-Host "Pattern '$Pattern' not found in '$($_.FullName)'"
|
||||
$ScriptsWithBrokenShebang += $($_.FullName)
|
||||
$ScriptWithoutShebangLine += $($_.FullName)
|
||||
}
|
||||
}
|
||||
return $ScriptsWithBrokenShebang
|
||||
return $ScriptWithoutShebangLine
|
||||
}
|
||||
|
||||
$ScriptsWithBrokenShebang = Validate-Scripts -Path $path -Pattern "#!/bin/bash -e"
|
||||
$ScriptsWithBrokenShebang = @()
|
||||
$ScriptsWithBrokenShebang += Validate-Scripts -Path $path1 -Pattern "#!/bin/bash -e"
|
||||
$ScriptsWithBrokenShebang += Validate-Scripts -Path $path2 -Pattern "#!/bin/bash -e"
|
||||
if ($ScriptsWithBrokenShebang.Length -gt 0) {
|
||||
$ScriptsWithBrokenShebang | ForEach-Object {
|
||||
Write-Warning "The following script does not contain shebang: '$_'"
|
||||
|
||||
Reference in New Issue
Block a user