Skip to content

fix(ci): Post drift comment when XAML/sync-gen diff exceeds 400 lines - #23188

Merged
MartinZikmund merged 1 commit into
masterfrom
dev/mazi/xamlformatadjust
May 5, 2026
Merged

MartinZikmund merged 1 commit into
masterfrom
dev/mazi/xamlformatadjust

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

GitHub Issue: closes #23187

PR Type:

🏗️ Build or CI related changes

What changed? 🚀

The XAML Style Check and WinAppSDK Sync Generator Check workflows are supposed to post a PR comment with apply instructions whenever drift is detected. When the drift is larger than ~400 lines, the Detect drift step itself fails with exit code 141 and the subsequent Post drift comment / Upload patch artifact / Fail if drift detected steps are silently skipped because their if: steps.drift.outputs.drift == 'true' condition is never satisfied.

Example failure: https://github.com/unoplatform/uno/actions/runs/25309801791/job/74193786071?pr=23180 — drift was detected but no PR comment was posted.

Root cause

The Detect drift step runs under bash --noprofile --norc -e -o pipefail and contains:

git -c color.ui=always diff --cached | head -n 400

When the diff is larger than 400 lines, head closes its stdin after reading 400 lines. git diff continues writing, gets SIGPIPE on its next write, and exits 141. With pipefail the pipeline returns 141, and set -e aborts the step before it can record drift=true.

The same line exists in winappsdk-sync-check.yml and is just as vulnerable; it has not tripped yet because past sync-gen drifts have stayed under 400 lines.

Fix

Append || true to the truncated-diff pipeline in both workflows so SIGPIPE from head closing early does not abort the step. The patch artifact and the drift=true output are unaffected; the only change is that the colored, truncated console preview tolerates being cut short.

PR Checklist ✅

The truncated diff pipeline `git diff | head -n 400` runs under
`set -e -o pipefail`. When the diff exceeds 400 lines, head closes
its stdin early, git diff is killed by SIGPIPE (exit 141), pipefail
propagates that, and -e aborts the step. The drift-comment step is
then skipped because its `if` condition never gets to evaluate.

Append `|| true` so the truncation does not fail the step.

Fixes #23187
Copilot AI review requested due to automatic review settings May 4, 2026 09:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts CI drift-detection workflows so that large diffs (over ~400 lines) don’t cause the “Detect drift” step to fail due to SIGPIPE when piping git diff into head, ensuring downstream steps (posting PR comments, uploading patch artifacts, and failing the job) still run when drift is present.

Changes:

  • Update XAML Style Check drift console preview to tolerate head truncation without failing the step.
  • Apply the same fix to WinAppSDK Sync Generator Check to prevent the same failure mode there.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/xaml-style-check.yml Prevents large drift previews from aborting the drift-detection step, allowing comment/artifact/fail steps to execute.
.github/workflows/winappsdk-sync-check.yml Same SIGPIPE-tolerance adjustment for sync-generator drift previews to ensure consistent downstream behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/xaml-style-check.yml Resolved
@MartinZikmund
MartinZikmund enabled auto-merge May 4, 2026 09:14
@MartinZikmund MartinZikmund added the ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met label May 4, 2026
@MartinZikmund
MartinZikmund merged commit c3523f7 into master May 5, 2026
18 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/xamlformatadjust branch May 5, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: XAML style / sync-gen drift comment is skipped when diff exceeds 400 lines

3 participants