CloudHTTP & APIsScheduled

Scheduled Auto-Merge Window

Every Monday at 9am lists open PRs carrying the 'ready-to-merge' label, verifies checks are green, and merges each in priority order — creating a predictable weekly release-train cadence.

Members OnlySign in or create a free account to download this solution.

Overview

Weekly release-train automation. Every Monday at 9:00 AM Eastern, scans a target GitHub repository for open PRs tagged with a configurable "ready-to-merge" label, verifies each PR is mergeable, squash-merges qualifying PRs, and posts a consolidated summary to a Teams channel.

Environment-variable driven (no hard-coded orgs, repos, labels, Teams targets), ships in its own Dataverse solution, delivered Off so the importing tenant can review and activate.

**State:** Off (Stopped)

Use Case

Engineering teams that practice trunk-based development or have a weekly release-train cadence benefit from a predictable, low-ceremony merge window. Apply a ready-to-merge label to anything to ship this cycle. Flow handles the rest: gates on mergeability, squashes the history, broadcasts release notes to Teams.

Single run produces one Teams post with the full list of merged PRs — no spam throughout the week.

Flow Architecture

Trigger: **Every Monday At 9AM** (Recurrence Weekly Monday 09:00 ET).

1. Init 9 vars (org, repo, ready label, Teams group/channel, merge method='squash', merged count=0, merged summary='')
2. **Get Open Pull Requests** (GitHub GetPullRequests state=open)
3. **Filter PRs With Ready Label** (Filter array via `contains(string(item()['labels']), '"name":"<label>"')`)
4. **For Each Eligible PR**:
   - Get Pull Request Details (needed for `mergeable` field)
   - Check PR Is Mergeable (If `mergeable == true`)
     - Yes: Merge Pull Request (squash) → Increment count → Append `<li>` to summary
     - No: skip silently
5. **Post Summary To Teams** (HTML body with count + accumulated list)

Environment Variables

VariableSchema NameTypeDefaultPurpose
FlowLibs GitHub Orgflowlibs_github_orgString(none)GitHub org or user that owns the target repo
FlowLibs GitHub Repoflowlibs_github_repoString(none)Repository name
FlowLibs Ready Labelflowlibs_ready_labelStringready-to-mergeLabel applied to PRs to merge this cycle
FlowLibs Teams Group Idflowlibs_teams_group_idString(none)GUID of the Teams team for the summary
FlowLibs Teams Channel Idflowlibs_teams_channel_idString(none)Channel ID inside the team

Connectors & Connections

ConnectorAPI NameConnection FormatUsage
GitHubshared_githubOAuthGetPullRequests + GetPullRequest + MergePullRequest
Microsoft Teamsshared_teamsOAuthPostMessageToConversation (Flow bot)

Customization Guide

1. Set 5 env vars (org, repo, label, Teams group/channel).
2. Bind GitHub + Teams connection refs.
3. Turn on.

**Common Modifications:** change merge strategy (merge or rebase); change schedule; tighten mergeability gate via mergeable_state == 'clean'; multi-repo via outer Foreach.

Key Expressions

- @contains(string(item()?['labels']), concat('"name":"', variables('varPRReadyLabel'), '"')) — Filter PRs by ready label
- @equals(body('Get_Pull_Request_Details')?['mergeable'], true) — mergeability gate (null-safe)
- @concat('<li>PR #', items('For_Each_Eligible_PR')?['number'], ' — ', items('For_Each_Eligible_PR')?['title'], '</li>') — summary accumulator

Scheduled Auto-Merge Window — FlowLibs | FlowLibs