-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First attempt at filing bugs if WDK is out-of-date #850
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -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" | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
Comment on lines
+28
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix PowerShell script and update deprecated workflow commands The script has multiple issues:
Apply these fixes: run: |
# Get the latest version of the Windows Driver Kit
$packages = nuget list "Microsoft.Windows.WDK.x64"
- $packageLine = $package | Where-Object { $_ -match $packageName }
+ $packageLine = $packages | Where-Object { $_ -match "Microsoft.Windows.WDK.x64" }
$packageVersion = $packageLine -replace "Microsoft.Windows.WDK.x64", ""
- echo "::set-output name=wdk_version::$packageVersion"
+ "wdk_version=$packageVersion" >> $env:GITHUB_OUTPUT 📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.4)28-28: workflow command "set-output" was deprecated. use (deprecated-commands) |
||||||||||||||||||||||||||||||||
- name: Check the version of the WDK in the repo | ||||||||||||||||||||||||||||||||
id: check_repo_wdk | ||||||||||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||||||||||
$wdkVersion = (Get-Content -Path .\wdk.props | Select-String -Pattern "<WDKVersion>" | ForEach-Object { $_ -replace "<WDKVersion>", "" -replace "</WDKVersion>", "" }).trim() | ||||||||||||||||||||||||||||||||
echo "::set-output name=repo_wdk_version::$wdkVersion" | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
Comment on lines
+35
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling and update deprecated workflow commands The script needs error handling and uses deprecated commands. run: |
+ if (-not (Test-Path .\wdk.props)) {
+ Write-Error "wdk.props file not found"
+ exit 1
+ }
$wdkVersion = (Get-Content -Path .\wdk.props | Select-String -Pattern "<WDKVersion>" | ForEach-Object { $_ -replace "<WDKVersion>", "" -replace "</WDKVersion>", "" }).trim()
- echo "::set-output name=repo_wdk_version::$wdkVersion"
+ "repo_wdk_version=$wdkVersion" >> $env:GITHUB_OUTPUT 📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.4)37-37: workflow command "set-output" was deprecated. use (deprecated-commands) |
||||||||||||||||||||||||||||||||
- 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'] | ||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix workflow configuration issues
Several critical issues need to be addressed:
skip_check
step is referenced but not definedrepository
andref
)Either:
Or:
2. Remove the unused inputs:
📝 Committable suggestion
🧰 Tools
🪛 actionlint (1.7.4)
20-20: property "skip_check" is not defined in object type {}
(expression)
22-22: property "repository" is not defined in object type {}
(expression)
24-24: property "ref" is not defined in object type {}
(expression)