Skip to content

Fix bot-opened inter-branch merge policy matching - #36990

Closed
PureWeen wants to merge 10 commits into
mainfrom
pureween-automerge-inter-branch-merge-prs
Closed

Fix bot-opened inter-branch merge policy matching#36990
PureWeen wants to merge 10 commits into
mainfrom
pureween-automerge-inter-branch-merge-prs

Conversation

@PureWeen

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!

Description of Change

Remove the redundant isActivitySender: { issueAuthor: True } predicate from the inter-branch merge Policy Service rule.

The end-to-end retest after #36875 merged created #36989 with the exact expected github-actions[bot] author, title, head, and base, but Policy Service did not approve it or enable auto-merge. The additional issue-author predicate is the unique difference from the proven policy used by dotnet/vscode-csharp, which successfully auto-approves and enables merge-commit auto-merge for equivalent bot-opened inter-branch merge PRs.

For an Opened event, requiring the activity sender to be github-actions[bot] already binds the event to the bot that opened the PR. The exact target branch and fully anchored title checks remain unchanged, and Synchronize remains excluded.

Verification

  • .github/policies/resourceManagement.yml parses as YAML.
  • git diff --check passes.
  • The inter-branch rule retains the exact bot sender, Opened action, target branches, anchored titles, approval, and merge-method auto-merge actions.
  • Compared against the live known-good dotnet/vscode-csharp Policy Service rule and PR GraphicsView does not call Drawable's Draw() after each Invalidate on iOS #9595, where dotnet-policy-service approved and enabled MERGE auto-merge for a github-actions[bot] inter-branch merge PR.

Issues Fixed

Follow-up to #36875.

PureWeen and others added 9 commits July 28, 2026 08:27
The inter-branch merge flow opens "[automated] Merge branch ... => ..." PRs but
deliberately never merges them, so every clean forward merge still waits on a
human. Add a Policy Service rule that auto-approves those PRs and enables
auto-merge, matching what dotnet/roslyn and dotnet/vscode-csharp already do.

Scoped to the two flows this repo runs, and uses a merge commit because the
merge flow requires one rather than a squash or rebase. Conflicted PRs are
unaffected and still need a human.
Require both the exact generated title and the exact net11.0 target branch.
Do not auto-merge the net11.0 => release flow. The Policy Service still
enables native auto-merge with mergeMethod=merge, while maui-pr remains a
required check in a separate ruleset with no app bypass.
Cover both main => net11.0 and net11.0 => release/* automated merge PRs.
Re-approve and re-arm auto-merge when Arcade synchronizes the merge branch so
the organization latest-push approval rule is satisfied. Human conflict
resolution pushes do not match because their activity sender is not
GitHub Actions.
Require GitHub Actions to be both the activity sender and PR author before
automatically approving an Opened or Synchronize event. This excludes human
and fork PRs updated by the /rebase workflow. Also anchor both generated titles
and require exact target branches; release auto-merge fails closed when the
release train advances until the policy is updated.
Enumerate the remaining .NET 11 release milestones as exact target/title pairs.
This preserves the fail-closed target validation while avoiding a policy update
when the train advances from preview7 through rc1 and rc2.
Before invoking Arcade, skip the merge workflow when its generated PR is
still open. This turns each PR into an immutable snapshot: later source commits
wait for the next PR instead of synchronizing the current one and dismissing
its approval. Serialize workflow runs to avoid duplicate creation races.

With generated PRs no longer updated, Policy Service only approves the safe
Opened event; Synchronize is removed entirely.
Use exact bot-authored same-repository PR queries, resolve the active release target from net11.0, and dispatch scheduled release merges from the required branch.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1b2b2dd6-bf5f-4179-8a8f-c4c85b9bce26
Keep the release gate and Arcade on the same net11.0 configuration, defer scheduled dispatch until the safety-critical workflow sections have propagated, and scope read-only checks to read permissions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1b2b2dd6-bf5f-4179-8a8f-c4c85b9bce26
Remove the redundant issue-author predicate that does not match App-authored pull request events. The Opened action and github-actions bot sender already bind the rule to the bot-created PR event.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1b2b2dd6-bf5f-4179-8a8f-c4c85b9bce26
Copilot AI review requested due to automatic review settings July 31, 2026 17:10
@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 31, 2026 17:10 — with GitHub Actions Inactive
@github-actions

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 -- 36990

Or

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

Resolve the Policy Service rule in favor of the proven bot-sender-only Opened-event pattern.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1b2b2dd6-bf5f-4179-8a8f-c4c85b9bce26
@github-actions github-actions Bot added the area-docs Conceptual docs, API docs, Samples label Jul 31, 2026

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 updates the repository’s inter-branch merge automation by adding Policy Service rules to auto-approve/auto-merge specific bot-opened forward-merge PRs, and by adjusting the merge workflows to avoid updating an already-open merge PR while CI is running.

Changes:

  • Add a new Policy Service rule to approve and enable merge-commit auto-merge for tightly allow-listed, github-actions[bot]-opened forward merges.
  • Add concurrency + “check for existing open merge PR” gating so merge workflows keep generated PRs immutable during CI.
  • For the net11→release flow, add a default-branch scheduled dispatcher that triggers the actual merge run from net11.0.
Show a summary per file
File Description
.github/workflows/merge-net11-to-release.yml Adds schedule-dispatch + immutability gate and concurrency for net11→release merge PR generation.
.github/workflows/merge-main-to-net11.yml Adds immutability gate and concurrency for main→net11 merge PR generation.
.github/policies/resourceManagement.yml Adds an inter-branch merge Policy Service rule for bot-opened PR auto-approval + auto-merge.

Copilot's findings

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

Comment on lines 721 to 727
- if:
- payloadType: Pull_Request
- isPullRequest
- isActivitySender:
user: github-actions[bot]
issueAuthor: False
- isActivitySender:
issueAuthor: True
- isAction:
Copilot AI review requested due to automatic review settings July 31, 2026 17:15
@PureWeen

Copy link
Copy Markdown
Member Author

Superseded by #36992, which is based directly on current main and contains exactly one commit with the same two-line policy fix. Closing this PR because its reused branch retained the original squash-merged #36875 commit history.

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.

Copilot's findings

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

kubaflo pushed a commit that referenced this pull request Aug 1, 2026
<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Remove the redundant `isActivitySender: { issueAuthor: True }` predicate
from the inter-branch merge Policy Service rule.

The end-to-end retest after #36875 merged created #36989 with the exact
expected `github-actions[bot]` author, title, head, and base, but Policy
Service did not approve it or enable auto-merge. The additional
issue-author predicate is the unique difference from the proven policy
used by `dotnet/vscode-csharp`, which successfully auto-approves and
enables merge-commit auto-merge for equivalent bot-opened inter-branch
merge PRs.

For an `Opened` event, requiring the activity sender to be
`github-actions[bot]` already binds the event to the bot that opened the
PR. The exact target branch and fully anchored title checks remain
unchanged, and `Synchronize` remains excluded.

### Verification

- The branch contains exactly one commit relative to `main`.
- `.github/policies/resourceManagement.yml` parses as YAML.
- `git diff --check` passes.
- The PR diff is exactly one file with two deletions.
- The inter-branch rule retains the exact bot sender, `Opened` action,
target branches, anchored titles, approval, and merge-method auto-merge
actions.
- Compared against the live known-good `dotnet/vscode-csharp` Policy
Service rule and PR #9595, where `dotnet-policy-service` approved and
enabled `MERGE` auto-merge for a `github-actions[bot]` inter-branch
merge PR.

### Issues Fixed

Follow-up to #36875. Replaces #36990, whose branch retained the original
squash-merged PR history.

Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1b2b2dd6-bf5f-4179-8a8f-c4c85b9bce26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-docs Conceptual docs, API docs, Samples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants