mirror of
https://github.com/Yamato-Security/WELA.git
synced 2026-05-09 12:52:35 +02:00
59 lines
2.0 KiB
YAML
59 lines
2.0 KiB
YAML
name: Create auditpol_output.csv
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
os: [windows-2019, windows-2022, windows-2025]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- name: Generate csv from auditpol /list /subcategory:* /r
|
|
run: |
|
|
$data = auditpol /list /subcategory:* /r
|
|
$output = @()
|
|
$category = ""
|
|
foreach ($line in $data) {
|
|
if ($line -match "^Category/Subcategory") { continue }
|
|
if ($line -match "^\s+(.+),\{(.+)\}$") {
|
|
$subcategory = $matches[1].Trim()
|
|
$guid = $matches[2].Trim()
|
|
$output += [PSCustomObject]@{
|
|
Category = $category
|
|
Subcategory = $subcategory
|
|
GUID = $guid
|
|
}
|
|
} elseif ($line -match "^(.+),\{(.+)\}$") {
|
|
$category = $matches[1].Trim()
|
|
$guid = $matches[2].Trim()
|
|
$output += [PSCustomObject]@{
|
|
Category = $category
|
|
Subcategory = ""
|
|
GUID = $guid
|
|
}
|
|
}
|
|
}
|
|
$output | Export-Csv -Path "config/eid_subcategory_mapping-org.csv" -NoTypeInformation -Encoding UTF8
|
|
$output | Format-Table -AutoSize
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --global user.name 'github-actions[bot]'
|
|
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
|
|
- name: Commit changes
|
|
run: |
|
|
git add *.csv
|
|
if (git diff-index --quiet HEAD) {
|
|
echo "No changes to commit"
|
|
} else {
|
|
git commit -m "Automated update"
|
|
git push origin main
|
|
}
|