diff --git a/.github/workflows/check_wdk.yml b/.github/workflows/check_wdk.yml new file mode 100644 index 0000000000..043b4e01c2 --- /dev/null +++ b/.github/workflows/check_wdk.yml @@ -0,0 +1,62 @@ +# Copyright (c) eBPF for Windows contributors +# SPDX-License-Identifier: MIT + +# This workflow performs a build of the project and uploads the result as a build artifact. + +name: Check for updates to the Windows Driver Kit + +on: + # Run script every Sunday at midnight + schedule: + - cron: '0 0 * * 0' + # Allow manual triggering of the script + workflow_dispatch: + +jobs: + check: + runs-on: Windows-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + if: steps.skip_check.outputs.should_skip != 'true' + with: + repository: ${{inputs.repository}} + submodules: 'recursive' + ref: ${{inputs.ref}} + + - name: Check for updates to the Windows Driver Kit + id: check_wdk + run: | + # Get the latest version of the Windows Driver Kit + $packages = nuget list "Microsoft.Windows.WDK.x64" + $packageLine = $package | Where-Object { $_ -match $packageName } + $packageVersion = $packageLine -replace "Microsoft.Windows.WDK.x64", "" + echo "::set-output name=wdk_version::$packageVersion" + + - name: Check the version of the WDK in the repo + id: check_repo_wdk + run: | + $wdkVersion = (Get-Content -Path .\wdk.props | Select-String -Pattern "" | ForEach-Object { $_ -replace "", "" -replace "", "" }).trim() + echo "::set-output name=repo_wdk_version::$wdkVersion" + + - name: File issue if the versions don't match and an issue doesn't already exist + if: steps.check_wdk.outputs.wdk_version != steps.check_repo_wdk.outputs.repo_wdk_version + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const { data: issues } = await github.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open', + creator: 'github-actions[bot]', + labels: 'wdk-update' + }); + if (issues.length === 0) { + await github.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: 'Update the Windows Driver Kit', + body: 'The Windows Driver Kit version in the repository does not match the latest version available on NuGet. Please update the WDK version in the repository to match the latest version available on NuGet.', + labels: ['wdk-update'] + }); + }