ci: store Windows Defender scan logs as artifact on cross-platform build#39726
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…n try-catch Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
June 17, 2026 03:42
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves diagnosability of intermittent Windows Microsoft Defender scan failures in the cross-platform-build job by persisting Defender diagnostics and scan output as a workflow artifact, so the data survives beyond the ephemeral job log.
Changes:
- Emit a Defender diagnostics +
MpCmdRun.exeoutput log to$RUNNER_TEMP/defender-scan-log.txtat the end of the scan step. - Upload the log as a retained Actions artifact on Windows runs (
if: always() && runner.os == 'Windows'). - (Unrelated) Tighten validation for
update_release.bodyinrelease.lock.ymlby adding aminLengthconstraint.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/cgo.yml |
Adds Defender scan log generation and uploads the log as an artifact on Windows runs. |
.github/workflows/release.lock.yml |
Introduces a minLength validation constraint for update_release.body (appears unrelated to the PR’s stated scope). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 3
Comment on lines
+664
to
+665
| "maxLength": 65000, | ||
| "minLength": 20 |
| Write-Host "✅ Microsoft Defender scan completed successfully for $binaryPath" | ||
|
|
||
| - name: Upload Defender scan logs | ||
| if: always() && runner.os == 'Windows' |
Comment on lines
+1947
to
+1950
| with: | ||
| name: defender-scan-log-${{ github.run_id }}-${{ github.run_attempt }} | ||
| path: ${{ runner.temp }}/defender-scan-log.txt | ||
| retention-days: 7 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intermittent failures in the
Build & Test on windows-latestjob (e.g. run 27662036462) are hard to diagnose because the Defender scan diagnostic output is only available in the ephemeral job log.Changes
Scan built binary with Microsoft Defenderstep, writes a structured log to$RUNNER_TEMP/defender-scan-log.txtcontaining Defender status/preferences, binary hashes, and fullMpCmdRun.exeoutput. Write is wrapped intry-catchso a logging failure cannot cause the scan step to fail.Upload Defender scan logsstep (if: always() && runner.os == 'Windows') uploads the log file asdefender-scan-log-<run_id>-<attempt>, retained for 7 days — persisted even when the scan step fails.