add actions

This commit is contained in:
fukusuket
2025-03-09 14:41:46 +09:00
parent 44e3bb0c9b
commit e206adc300

View File

@@ -11,18 +11,30 @@ jobs:
- name: Generate csv from auditpol /list /subcategory:* /r - name: Generate csv from auditpol /list /subcategory:* /r
run: | run: |
$output = auditpol /list /subcategory:* /r $data = auditpol /list /subcategory:* /r
$data = $output | Select-Object -Skip 1 | Where-Object { $_ -match '.+\s{2,}.+' } $category = ""
$csvData = $data | ForEach-Object { foreach ($line in $data) {
$columns = $_ -split "\s{2,}" if ($line -match "^Category/Subcategory") { continue }
[PSCustomObject]@{ if ($line -match "^\s+(.+),\{(.+)\}$") {
"Subcategory" = $columns[0].Trim() $subcategory = $matches[1].Trim()
"Subcategory GUID" = $columns[1].Trim() $guid = $matches[2].Trim()
} $output += [PSCustomObject]@{
} Category = $category
$csvFilePath = "$PWD\auditpol_output.csv" Subcategory = $subcategory
$csvData | Export-Csv -Path $csvFilePath -NoTypeInformation -Encoding UTF8 GUID = $guid
Write-Output "CSVファイルが作成されました: $csvFilePath" }
} elseif ($line -match "^(.+),\{(.+)\}$") {
$category = $matches[1].Trim()
$guid = $matches[2].Trim()
$output += [PSCustomObject]@{
Category = $category
Subcategory = ""
GUID = $guid
}
}
}
$output | Export-Csv -Path "output.csv" -NoTypeInformation -Encoding UTF8
$output | Format-Table -AutoSize
- name: Configure Git - name: Configure Git
run: | run: |