Repository navigation
Conversation
…* branch instead of Azure DevOps credentials
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 40504Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 40504" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Active issues can leave PR checks stuck in progress after partial update failures and prevent workflow retries because reruns reuse an existing dispatch branch name.
2 open issues
What changed in this PR
This PR moves /review run-tests from Azure DevOps token-based queueing to run-tests/* branch dispatch, addressing the sign-in failures left unresolved by the earlier CI fixes.
Changes:
- Creates dispatch commits with PR code, target-branch pipelines and workflows, and validated test selections.
- Adds dispatch-branch pipeline support while excluding the MAUI secret variable group.
- Tracks build results through a PR-head check and comment, and removes expired dispatch branches.
| File | Description |
|---|---|
eng/pipelines/common/variables.yml |
Excludes MAUI variable-group secrets from dispatch builds. |
eng/pipelines/common/run-tests-request.yml |
Defines the dispatch request format with a run-nothing default. |
eng/pipelines/ci-uitests.yml |
Triggers dispatch builds and applies selected tests and PR lanes. |
.github/workflows/review-run-tests-results.yml |
Grants permissions for check updates and branch cleanup. |
.github/workflows/review-run-tests-dispatch.yml |
Replaces Azure authentication with branch-creation permissions. |
.github/scripts/Update-RunTestsResults.ps1 |
Updates dispatch checks and deletes expired branches. |
.github/scripts/RunTests.Tests.ps1 |
Adds request, branch, check-update, and pipeline-guard coverage. |
.github/scripts/RunTests.Common.ps1 |
Adds dispatch helpers and removes token-based queueing helpers. |
.github/scripts/Invoke-RunTests.ps1 |
Creates dispatch commits, waits for builds, and publishes tracking checks. |
.github/scripts/Get-RunTestsContext.ps1 |
Checks target-branch dispatch support before test selection. |
Review effort: Balanced
| $branch = Get-RunTestsDispatchBranch -PrNumber $PrNumber -RunId $DispatchRunId | ||
| Invoke-GhJson @('-X', 'POST', "repos/$Repository/git/refs") -InputJson (@{ ref = "refs/heads/$branch"; sha = $commit.sha } | ConvertTo-Json) | Out-Null |
| if ($comment.body -match '<!-- review-run-tests-check: (\d{1,20}) -->') { | ||
| $check = New-RunTestsRunCheckUpdate -Build $build -Results $results | ||
| $check | ConvertTo-Json -Depth 5 | & gh api -X PATCH "repos/$Repository/check-runs/$($Matches[1])" --input - | Out-Null | ||
| if ($LASTEXITCODE -ne 0) { Write-Warning "Could not update check run $($Matches[1])." } |
|
/review expert-review-with-gate |
|
Warning Your |
There was a problem hiding this comment.
Expert Review — 3 findings
Reviewed commit ba3da0f.
Source assessment incomplete (6/7 dimensions); finding count is partial.
See inline comments for details.
| $payload = @{ body = $updated } | ConvertTo-Json | ||
| $payload | & gh api -X PATCH "repos/$Repository/issues/comments/$($comment.id)" --input - | Out-Null | ||
| if ($LASTEXITCODE -ne 0) { Write-Warning "Could not update comment $($comment.id)." } | ||
| if ($comment.body -match '<!-- review-run-tests-check: (\d{1,20}) -->') { |
There was a problem hiding this comment.
[major] Logic and Correctness Verification - If the completed-comment PATCH succeeds but the check PATCH fails, the comment is already marked done while the PR's selected-run check stays in_progress. Scheduled sweeps exclude done comments, and a retry with -HeadSha exits at the unchanged-comment guard before reaching this update. Synchronize the check independently of comment changes and retain retryable state until both publications succeed. Add a mocked regression test for successful comment publication followed by failed check publication and retry; the new tests exercise only the check payload.
| [string]$AzdoToken = $env:RUN_TESTS_AZDO_TOKEN, | ||
| [int]$DefinitionId = 313, | ||
| # Names the dispatch branch; unique per request. | ||
| [string]$DispatchRunId = $(if ($env:GITHUB_RUN_ID) { $env:GITHUB_RUN_ID } else { [string][DateTimeOffset]::UtcNow.ToUnixTimeSeconds() }), |
There was a problem hiding this comment.
[major] Logic and Correctness Verification - GitHub workflow reruns preserve GITHUB_RUN_ID, so retrying a dispatch job after it creates the branch but fails during check/comment publication derives the same branch name. The unconditional create-ref POST then fails because that ref already exists, preventing recovery through Re-run failed jobs even with unchanged PR inputs. Include the run attempt in the branch identity (and update validation/cleanup), or verify and reuse the existing dispatch. Add a mocked regression test for retry with the prior ref already present; the branch-name test covers only a first attempt.
| param([Parameter(Mandatory)]$PullRequest, [Parameter(Mandatory)]$MergeCommit, [Parameter(Mandatory)]$Selection) | ||
| # The trusted half: pipeline and workflows of the target branch (or the trial's pipeline source). | ||
| $sourceSha = if ($PipelineSource) { $PipelineSource } else { | ||
| (Invoke-GhJson @("repos/$Repository/git/ref/heads/$($PullRequest.base.ref)")).object.sha |
There was a problem hiding this comment.
[major] Input and Path Correctness - The PR API's base.ref is interpolated into the gh api endpoint without URI encoding. For a valid target branch such as main#test, #test becomes a URL fragment, so this resolves heads/main instead. The returned SHA passes the subsequent validation and supplies the dispatch commit's pipelines, workflows and parent from the wrong branch (or the request fails if the prefix branch is absent). Encode the ref before constructing the endpoint; the existing encoded preflight request does not protect this separate lookup.

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!
Target Branch
CI workflow infrastructure follow-up to #40468 / #40485 / #40492, so it targets
main.Why
/review run-testsstill queues nothingSince about 21:00 UTC on 2026-11-20, every
/review run-testsdispatch fails at the same step: Microsoft Entra refuses the GitHub OIDC → Azure DevOps token exchange withAADSTS53003: Access has been blocked by Conditional Access policies. Before that, the same code queued build 1692555.review-trigger.yml(/review→ maui-copilot) fails the same way whenever it gets as far as the token step; its other runs only look green because they stop before it. #40492 added anAZDO_TRIGGER_PATfallback, but no such secret exists, and using a personal PAT to get around a Conditional Access policy is not a fix we should ship.The repo has no other way to queue a build. I checked each option:
AADSTS53003on every attempt since 2026-11-20/azp runcomment fromgithub-actions[bot]System.AccessTokenfalse, queue request 403 (probe #40502)Description of Change
/review run-testsnow starts maui-pr-uitests through its YAML CI trigger, so no Azure DevOps credentials are involved:Invoke-RunTests.ps1validates the selection as before, then uses the Git Data API to push a dispatch commit torun-tests/pr<N>-<run id>. Its tree is GitHub's test-merge tree of the PR, witheng/pipelinesand.githubreplaced by the copies at the target branch tip, plus a generatedeng/pipelines/common/run-tests-request.yml. Its parent is that target-branch commit, so the push changes no workflow. GITHUB_TOKEN is not allowed to change workflows, and its pushes don't start Actions runs.ci-uitests.ymlnow buildsrun-tests/*branches. For those branches it reads the request and passes the sameselectedPlatforms/selectedCategoriestocommon/ui-tests.ymlthat theuitest_*parameters produced before. If the mode isn'tfull, the run is narrowed, so an unfilled request runs nothing rather than the full suite. Dispatch builds get the pull-request lanes (iOSlatestonly).variables.ymldoesn't link theMAUIvariable group (maui-cert-password) forrun-tests/*builds. PR code then runs without secrets, as it does in a PR build from a fork. The pipeline YAML always comes from the target branch, never from the PR.maui-pr-uitests (selected run)check on the PR head follows the build. The skipped and selection checks are unchanged.Update-RunTestsResults.ps1matches comments by the dispatch commit too, completes that check, and its 30-minute sweep deletes dispatch branches older than 3 days.id-token: write, and the template-parameter queue request. The dispatch workflow now needscontents: write, and the results workflow needschecks: writeandcontents: write.Validation
Invoke-RunTests.ps1locally with this branch as-PipelineSource, on [CollectionView] Add ItemTapped event and ItemTappedCommand #40437 at85ec75d5, with the real GPT-6.1 Sol and Claude Opus 5.5 proposals from run 44944036321. It pushedrun-tests/pr40437-1795314808(dispatch commit81026002), and maui-pr-uitests build 1693858 started from the CI trigger about 15 s later. That build has 8 stages instead of 12, and only maui-pr-uitests built the branch. The comment was posted, andUpdate-RunTestsResults.ps1finds it by the dispatch commit.selected: only the selected stages; each matrix holds only the selected categories, and the zero-tests guard is on.full: all 12 stages.none): rejected with "no stages", never the full suite.MAUIgroup.RunTests.Tests.ps1andCopilotPipeline.Tests.ps1: 68 passed. The new tests cover:MAUIgroup exclusion and that no other pipeline buildsrun-tests/*;For reviewers
/review, which this PR does not touch.run-tests/*branches appear in dotnet/maui. No ruleset, Actions workflow or other pipeline reacts to them.