Parse urls for CVE info #47
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Parse CAB | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: "0 9 * * 2" | |
workflow_dispatch: | |
jobs: | |
generate-matrix: | |
runs-on: windows-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Calculate matrix | |
id: set-matrix | |
run: | | |
# Download the cab file and get the number of nested cab files | |
$folders = .\wsusscn2_parse.ps1 -Count | |
# Break it up into 10 folder chunks | |
$chunks = [int][Math]::Ceiling($folders/10) | |
# Generate the matrix | |
$matrix = 1..$chunks | |
# Convert the matrix to JSON | |
$matrix_json = $matrix | ConvertTo-Json -Compress | |
# Set output | |
Write-Output "matrix=$matrix_json" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
parse-cab: | |
runs-on: windows-latest | |
needs: generate-matrix | |
strategy: | |
matrix: | |
chunk: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Parse Cab Chunk ${{ matrix.chunk }} | |
id: parse-cab-chunk | |
uses: nick-fields/retry@v3 | |
with: | |
command: . .\wsusscn2_parse.ps1 -Chunk ${{ matrix.chunk }} | |
max_attempts: 3 | |
timeout_minutes: 360 | |
- name: Get Remaining Disk Space | |
run: | | |
Get-Volume | |
- name: Upload Artifact Chunk ${{ matrix.chunk }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wsus-updates-${{ matrix.chunk }} | |
path: wsus_updates_${{ matrix.chunk }}.json | |
retention-days: 1 | |
join-artifacts: | |
needs: parse-cab | |
runs-on: windows-latest | |
steps: | |
- name: Download All Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- name: show me stuff | |
run: | | |
Get-ChildItem . -Recurse | Select FullName | Write-Host | |
- name: Merge Artifacts | |
run: | | |
$json_files = Get-ChildItem -Path . -Filter *.json | |
$merged_data = @{} | |
$json_files | ForEach-Object { | |
$json_content = Get-Content -Path $_.FullName | ConvertFrom-Json | |
$json_content.PSObject.Properties | ForEach { | |
$merged_data[$_.Name] = $_.Value | |
} | |
} | |
$json_data = $merged_data | ConvertTo-Json -Depth 10 | Out-String | |
$json_file = "wsus_updates.json" | |
$UTF8NoBOM = New-Object System.Text.UTF8Encoding $false | |
[System.IO.File]::WriteAllText($json_file, $json_data, $UTF8NoBOM) | |
- name: Upload Merged Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wsus_updates | |
path: wsus_updates.json | |
- name: Create release | |
if: github.event_name == 'schedule' | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: 'wsus_updates.json' |