Fix /review trigger when comment has leading whitespace#35438
Merged
Conversation
The job-level if used startsWith(github.event.comment.body, '/review '), which fails when the comment body starts with whitespace (e.g. ' /review -b feature/foo'). GitHub expression syntax has no trim/regex, so we can't reliably handle this at the expression level. Add a tiny pre-filter match job that uses a bash regex (^[[:space:]]*/review([[:space:]]|\$)) to decide whether to run. The main rigger-review job now eeds: match and gates on its output. Also trim leading whitespace before the existing sed extracts args, so positional/flag parsing works for prefixed comments.
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 35438Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 35438" |
kubaflo
approved these changes
May 14, 2026
Member
Author
|
/azp run maui-pr-uitests, maui-pr-devicetests |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
This was referenced May 15, 2026
This was referenced May 21, 2026
Draft
This was referenced May 30, 2026
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.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Problem
The
/reviewslash command in.github/workflows/review-trigger.ymlis silently skipped when the comment body has any leading whitespace before/review.Concrete example:
' /review -b feature/regression-check'— note the leading space (0x20).Root cause
The job-level guard was:
startsWith(' /review ...', '/review ')returnsfalse, so the job is skipped. GitHub expression syntax has notrimor regex, so we can't fix this purely at the expression level. TheParse parametersstep had the same blind spot —sed -n 's|^/review[[:space:]]*||p'produces emptyARGSif the body doesn't start with/review.Fix
matchpre-filter job that uses a bash regex (^[[:space:]]*/review([[:space:]]|$)) to decide whether the comment is a/reviewcommand. It allows arbitrary leading whitespace (spaces, tabs, newlines) but still requires/reviewto be a standalone token (won't match/reviewfooor comments that merely mention/reviewmid-sentence).trigger-reviewnowneeds: matchand gates on its output, keeping the rest of the job structure intact.sedinParse parameters, so flag/positional parsing works on prefixed comments like/review -b feature/foo.Verification
Local check of the regex against representative inputs:
/review/review android/review -b feature/regression-check(the failing case)\t/review/review -p ios/reviewfooplease /review thisnot a commandThe full end-to-end behavior will be exercised by the next
/reviewinvocation on a PR that targets this branch.