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.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
FlowLibs - Scheduled Auto-Merge Window is a weekly release-train automation. Every Monday at 9:00 AM Eastern, it scans a target GitHub repository for open pull requests tagged with a configurable "ready-to-merge" label, verifies each PR is mergeable (checks passed, no conflicts), squash-merges the qualifying PRs, and posts a consolidated summary to a Microsoft Teams channel.
The flow is environment-variable driven (no hard-coded orgs, repos, labels, or Teams targets), ships in its own Dataverse solution, and is delivered in the Off state so the importing tenant can review and activate it on their own schedule.
Use Case
Engineering teams that practice trunk-based development or have a weekly release-train cadence benefit from a predictable, low-ceremony merge window. Instead of asking developers to chase down maintainers on Mondays — or letting PRs languish because nobody wants to be "the approver" — they apply a ready-to-merge label to anything they want shipped this cycle. The flow handles the rest: gates on mergeability, squashes the history clean, and broadcasts the release notes to the team's Teams channel.
The flow is ideal for teams that:
- Predictable weekly release-train cadence without a full CD platform.
- Reduce Monday-morning chase-down between engineers and maintainers.
- One Teams post per week summarizing the merged PRs — no per-PR spam.
- Squash-merge by default to keep history clean.
Flow Architecture
Every Monday At 9AM
RecurrenceWeekly Monday 09:00 America/New_York.
Init 9 variables
InitializeVariablevarGitHubOrg, varGitHubRepo, varPRReadyLabel, varTeamsGroupId, varTeamsChannelId from env vars; varMergeMethod=`squash`, varMergedCount=0, varMergedSummary=''.
Get Open Pull Requests
GitHub GetPullRequestsLists open PRs in the target repo.
Filter PRs With Ready Label
Filter arrayKeeps only PRs whose labels array contains the configured ready-label name.
For Each Eligible PR
ForeachInner: Get_Pull_Request_Details (mergeable field) → Check PR Is Mergeable → If yes: MergePullRequest (squash), increment counter, append HTML summary line.
Post Summary To Teams
Teams PostMessageToConversationPosts an HTML body showing the merged count, the accumulated list, and the run timestamp.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_github_org | String | — | GitHub org or user that owns the target repo. |
| flowlibs_github_repo | String | — | Repository name (without the org prefix). |
| flowlibs_ready_label | String | ready-to-merge | Label applied to PRs that should be merged this cycle. |
| flowlibs_teams_group_id | String | — | GUID of the Teams team where the summary is posted. |
| flowlibs_teams_channel_id | String | — | Channel ID inside the team for the summary post. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| GitHub | shared_github | GetPullRequests GetPullRequest MergePullRequest |
| Teams | shared_teams | PostMessageToConversation (Flow bot → Channel) |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Change the merge strategy
- Edit Init varMergeMethod from squash to merge (merge commit) or rebase (rebase-and-merge).
- Change the schedule
- Adjust the Recurrence frequency, interval, days of week, or time zone (daily at midnight, last-Friday-of-month, twice-weekly).
- Change the label
- Update the flowlibs_ready_label environment variable. No flow-definition changes are needed.
- Change the target repo / org
- Update flowlibs_github_org and flowlibs_github_repo env vars.
- Tighten the mergeability gate
- Add an And branch comparing mergeable_state to clean (clean / dirty / blocked / unstable).
- Scale to multiple repos
- Wrap the GetPullRequests / Foreach in an outer Foreach over an array of repo names.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Filter PRs by ready label
Serializes labels and checks for the exact name token.
EXPR.02Mergeability gate
Null-safe accessor — null mergeable evaluates false.
EXPR.03Summary accumulator
Appends one HTML <li> per merged PR.
EXPR.04Teams post body (HTML)
Renders the consolidated summary message.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.