Skip to content

Re-enable environment gating on review-trigger.yml with copilot-pat-pool - #36414

Closed
PureWeen wants to merge 1 commit into
mainfrom
pureween-reenable-review-trigger-environment-gati
Closed

PureWeen wants to merge 1 commit into
mainfrom
pureween-reenable-review-trigger-environment-gati

Conversation

@PureWeen

@PureWeen PureWeen commented Jul 6, 2026

Copy link
Copy Markdown
Member

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!

Summary

Re-adds environment: copilot-pat-pool to the trigger-review job in review-trigger.yml.

Why

Environment gating was originally added in #35974 (environment: gh-aw-agents) and then reverted in #36005. The revert was necessary because gating changes the GitHub OIDC token subject from repo:dotnet/maui:ref:refs/heads/main to an environment-scoped subject, and the managed identity (Testing-MI-gh2zdo, behind AZDO_TRIGGER_CLIENT_ID) had no federated credential for that subject — so every /review command failed with:

AADSTS700213: No matching federated identity record found for presented
assertion subject 'repo:dotnet/maui:environment:gh-aw-agents'

That was a temporary workaround put in place while we couldn't add/fix the credential on the managed identity. The environment has since been standardized to copilot-pat-pool (#36204), and a matching federated credential is being added to the identity:

--subject "repo:dotnet/maui:environment:copilot-pat-pool"

With that credential in place, the environment gating can be restored.

What changed

  • Re-added environment: copilot-pat-pool to the trigger-review job (1 line).
  • No other jobs affected; id-token: write and the OIDC → AzDO token exchange are unchanged.

⚠️ Merge prerequisite

Do not merge until the federated credential with subject repo:dotnet/maui:environment:copilot-pat-pool exists on the Testing-MI-gh2zdo managed identity. Merging before the credential is created will break /review again with AADSTS700213.

Validation

After merge, run /review on a PR and confirm the trigger-review job's OIDC → AzDO token exchange succeeds (no AADSTS700213) and the maui-copilot pipeline is triggered.

Re-adds `environment: copilot-pat-pool` to the trigger-review job. This was
removed in #36005 because the Testing-MI-gh2zdo managed identity (behind
AZDO_TRIGGER_CLIENT_ID) had no federated credential matching the
environment-scoped OIDC subject, which broke /review.

A federated credential with subject
'repo:dotnet/maui:environment:copilot-pat-pool' is being added to the
managed identity, so the environment gating can be restored.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 6, 2026 17:43
@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 6, 2026 17:43 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36414

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36414"

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 re-enables GitHub Actions environment gating for the /review trigger workflow by restoring environment: copilot-pat-pool on the trigger-review job in .github/workflows/review-trigger.yml. This aligns the job’s OIDC subject with the intended environment-scoped federated identity configuration for the AzDO token exchange.

Changes:

  • Re-added environment: copilot-pat-pool to the trigger-review job so environment-scoped secrets and the environment-scoped OIDC subject are used.
Show a summary per file
File Description
.github/workflows/review-trigger.yml Restores environment gating for the trigger-review job to use the copilot-pat-pool environment.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 6, 2026 17:46 — with GitHub Actions Inactive
@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 6, 2026 17:47 — with GitHub Actions Inactive
@github-actions github-actions Bot added the area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions label Jul 6, 2026
@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 6, 2026 17:47 — with GitHub Actions Inactive
@PureWeen PureWeen closed this Jul 6, 2026
@PureWeen
PureWeen deleted the pureween-reenable-review-trigger-environment-gati branch July 6, 2026 17:55
@PureWeen

PureWeen commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

Closing — after review, review-trigger.yml doesn't need environment gating. It uses no Copilot PATs, and its only secrets (AZDO_TRIGGER_*) are repo-level, so an environment provides no secret-access benefit. It's already authz-gated by an actor-permission check (write/maintain/admin only). Gating would only re-introduce the workflow↔federated-credential coupling that broke /review in #35974 → #36005, with no functional upside. Leaving it ungated on the ref-based credential.

@github-actions github-actions Bot locked and limited conversation to collaborators Aug 6, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — d8ad36b1 Deployed Jul 6, 2026 by PureWeen via conclusion #697
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants