Release Branch Auto-Cutter
On Approvals response 'Cut release for sprint X', creates a new release/x.y branch ref from the latest main SHA via Create A Reference and posts the new branch link in a Teams release channel.
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
This flow puts a governance checkpoint in front of GitHub release-branch creation. A developer or release manager starts the flow with a single text input (e.g. 2026.04 or 1.2), which kicks off an approval request. Once the designated approver (typically the release manager) approves, the flow reads the current head SHA of the base branch in the configured GitHub repository, creates a new release branch from that SHA, and posts a link to the new branch in a Teams release channel. If the request is rejected, the Teams channel is notified of the rejection instead.
The flow uses three premium / standard connectors — Approvals, GitHub, and Microsoft Teams — and is fully configurable through environment variables, so it can be repointed at any repository, base branch, or Teams channel without touching the flow definition.
Use Case
Release-branch creation is typically a two-step process: a release manager decides *when* to cut the branch, and someone with write access to the repo actually creates it. Doing this manually works fine for small teams, but as release cadence tightens and more teams touch the same repo, manual branch creation becomes both a coordination bottleneck and an audit-trail weakness — there's no record of who approved the cut, when, or for which sprint.
This flow formalizes the process: the sprint owner triggers the flow with the sprint identifier, the release manager gets a standard Power Automate approval request, and on approval the branch is cut programmatically. The Teams channel message provides an immediate, searchable notification to everyone on the team, and the Approvals history provides a durable audit trail.
The flow is ideal for teams that:
- Cut sprint or release branches on a predictable cadence and want to remove manual git-ref-creation overhead.
- Need an auditable record of who approved a release cut and when.
- Want non-technical stakeholders (release managers, product owners) to initiate branch cuts without needing to use git directly.
- Already use Power Automate Approvals and Teams for other governance workflows.
Flow Architecture
Init_varGitHubOwner through Init_varTeamsChannelId
7 actionsSeven Initialize Variable actions that hydrate working variables from the environment variable parameters. This indirection keeps the connector-facing expressions short and readable.
Init_varSprint
ComposeCaptures the user's trigger input into varSprint.
Init_varReleaseBranchName
ComposeComposes the full release branch name by concatenating the configured release prefix (default `release/`) with the sprint identifier.
Start_Release_Approval
StartAndWaitForAnApprovalCalls the Approvals connector's basic approval type. The flow pauses until the approver responds in the Approvals center, Teams, or email.
Check_Approval_Outcome
If conditionBranches on outputs('Start_Release_Approval')?['body/outcome'] equals 'Approve'.
- Get_Base_Branch_Reference — GitHub GetReference for heads/{base-branch} returns the current SHA.
- Create_Release_Branch_Reference — GitHub CreateReference creates the new branch pointing at that SHA.
- Post_Release_Branch_To_Teams — Teams PostMessageToConversation posts the announcement.
A single Teams message is posted noting that the release-branch request was not approved.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_GitHubOwner | String | — | GitHub user or org that owns the target repository. |
| flowlibs_GitHubRepo | String | — | Target GitHub repository name (without the owner). |
| flowlibs_GitHubBaseBranch | String | main | Branch to read the head SHA from when cutting the release. |
| flowlibs_ReleaseBranchPrefix | String | release/ | Prefix applied to the sprint identifier to form the new branch name. |
| flowlibs_ApproverEmail | String | — | UPN/email of the release manager who will receive the approval request. |
| flowlibs_TeamsGroupId | String | — | ID of the Teams team that owns the release channel. |
| flowlibs_TeamsChannelId | String | — | ID of the Teams channel where branch-cut notifications are posted. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Approvals | shared_approvals | StartAndWaitForAnApproval (basic approval type) |
| GitHub | shared_github | GetReference CreateReference |
| Teams | shared_teams | PostMessageToConversation (used twice — approve and reject branches) |
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.
- Target a different repo
- Update flowlibs_GitHubOwner and flowlibs_GitHubRepo env vars. No flow definition changes needed.
- Cut from a branch other than main
- Set flowlibs_GitHubBaseBranch to develop, trunk, or whatever the repo's long-lived base branch is named.
- Use a different branch naming convention
- Change flowlibs_ReleaseBranchPrefix to e.g. rc/, releases/, or hotfix/.
- Route approvals to a different approver
- Change flowlibs_ApproverEmail. To route to a group, pass a semicolon-delimited list of emails.
- Post to a different Teams channel
- Update flowlibs_TeamsGroupId and flowlibs_TeamsChannelId.
- Add multiple approvers in sequence
- Replace Start_Release_Approval with two chained approvals.
- Emit more metadata
- The Teams message composes an HTML string via concat(). Add additional variables to enrich the announcement.
- Swap Teams for Slack or email
- Replace the PostMessageToConversation actions with Slack PostMessage or Outlook SendEmailV2.
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.01Compose the release branch name
Used in Init_varReleaseBranchName — joins e.g. release/ with 1.2 to make release/1.2.
EXPR.02Get base branch SHA from GetReference output
The GitHub GetReference response nests the SHA under body.object.sha.
EXPR.03Compose the full ref for the new branch
GitHub's API requires the fully qualified reference in body/ref.
EXPR.04Check approval outcome
Drives the If branch after the approval resolves.
EXPR.05Build the Teams success message
Builds a clickable link to the new branch on GitHub plus provenance metadata.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.