Skip to content

Commit

Permalink
Update load-used-actions.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
rajbos authored Sep 8, 2023
1 parent a288350 commit 3fa2368
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions Src/PowerShell/load-used-actions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,10 @@ function GetActionsFromWorkflow {
[string] $repo
)

# create hastable
$actions = @()
if ($workflow.Length -lt 25 -Or !$workflow.Contains("on") -Or !$workflow.Contains("jobs")) {
Write-Host "Worflow [$workflowFileName] from repo [$repo] content is less then 20 characters, cannot be a valid document, so skipping it"
return $actions
}

# parse the workflow file and extract the actions used in it
$parsedYaml =""
try {
$parsedYaml = ConvertFrom-Yaml $workflow

if ($null -eq $parsedYaml -Or $parsedYaml.Length -eq 0) {
return $actions
}
}
catch {
Write-Warning "Error parsing the yaml from this workflow file: [$workflowFileName] in repo: [$repo]"
Expand All @@ -56,10 +45,11 @@ function GetActionsFromWorkflow {
Write-Warning ""
Write-Warning "Error:"
Write-Warning $_
return $actions
return
}

# go through the parsed yaml
# create hashtable
$actions = @()
try {
if ($null -ne $parsedYaml["jobs"] -And "" -ne $parsedYaml["jobs"]) { #else: write info to summary?
# go through the parsed yaml
Expand Down Expand Up @@ -159,7 +149,7 @@ function GetAllUsedActionsFromRepo {
Write-Warning "----------------------------------"
Write-Host "Error: [$_]"
Write-Warning "----------------------------------"
#continue # continue breaks with an error and does not really continue
#continue
}
}

Expand Down

0 comments on commit 3fa2368

Please sign in to comment.