Update Lenovo Driver Pack Catalog #35
This file contains hidden or 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: Update Lenovo Driver Pack Catalog | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 */4 * * *' | |
| permissions: | |
| contents: write | |
| jobs: | |
| update: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Download Lenovo catalogv2.xml | |
| shell: pwsh | |
| run: | | |
| $xmlPath = "$env:TEMP\catalogv2.xml" | |
| Write-Host "Downloading Lenovo catalogv2.xml..." | |
| Invoke-WebRequest -Uri 'https://download.lenovo.com/cdrt/td/catalogv2.xml' -OutFile $xmlPath -UseBasicParsing | |
| Write-Host "Downloaded: $((Get-Item $xmlPath).Length) bytes" | |
| Copy-Item $xmlPath 'OSDCloud\catalogs\driverpack\lenovo.xml' -Force | |
| Write-Host "Replaced OSDCloud\catalogs\driverpack\lenovo.xml" | |
| [xml]$xml = Get-Content 'OSDCloud\catalogs\driverpack\lenovo.xml' -Raw | |
| $version = $xml.DocumentElement.GetAttribute('version') | |
| Write-Host "Lenovo catalog version: $version" | |
| - name: Commit if changed | |
| shell: pwsh | |
| run: | | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add OSDCloud/catalogs/driverpack/lenovo.xml | |
| if (git diff --cached --quiet) { | |
| Write-Host "No changes to commit." | |
| } else { | |
| [xml]$xml = Get-Content 'OSDCloud\catalogs\driverpack\lenovo.xml' -Raw | |
| $version = $xml.DocumentElement.GetAttribute('version') | |
| $date = (Get-Date -Format 'yyyy-MM-dd') | |
| git commit -m "chore(catalog): update Lenovo driver pack catalog (v$version $date)" | |
| git push | |
| } |