Bitbucket Daily Open PR Digest
Each morning the flow summarizes open Bitbucket pull requests across the team's repos — awaiting review, approved and ready to merge, changes requested, and oldest open — and posts a digest to a Teams dev channel plus a per-reviewer breakdown. Keeps code review visible and nothing forgotten.
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
A scheduled cloud flow that, every morning, gathers the open pull requests across a configured set of Bitbucket repositories, classifies each one (awaiting review, approved & ready to merge, changes requested, and stale/oldest), and delivers a single readable digest to a Microsoft Teams dev channel plus an HTML email to the dev lead. It replaces the daily ritual of clicking through Bitbucket repos to see "what's waiting on whom."
This is a demo / reference flow. It ships Off; going live requires only authorizing the three connections and setting the six environment-variable values — no logic changes.
Use Case
Teams that spread work across several Bitbucket repositories lose visibility into review state. Reviews stall, PRs rot, and nobody notices the oldest open one. This flow gives the whole team a once-a-day, no-click readout: how many PRs are open, which are blocked on a review, which are ready to merge, which were sent back for changes, and which have been open past the staleness threshold. The email adds a per-PR breakdown of the reviewers who still owe a review.
Flow Architecture
Recurrence
Recurrence (daily, default 08:00 Eastern)Runs once daily; no webhook, the connector returns open PRs on demand
Initialize varBitbucketWorkspace
Initialize VariableBitbucket workspace/account slug (from flowlibs_BitbucketWorkspace)
Initialize varRepoSlugs
Initialize VariableComma-separated repo slugs to scan (from flowlibs_BitbucketRepoSlugs)
Initialize varTeamsGroupId / varTeamsChannelId
Initialize VariableTarget Teams channel (from env vars)
Initialize varDigestRecipient
Initialize VariableDigest email recipient (from flowlibs_DigestRecipientEmail)
Initialize varStaleDays
Initialize VariableStaleness threshold in days, cast to integer (from flowlibs_StalePrThresholdDays)
Initialize varAllPRs
Initialize VariableEmpty array accumulator
Apply to each Repository
Foreach (over split(varRepoSlugs, ','), sequential)List Open Pull Requests (Bitbucket ListPullRequests) then loop each PR: filter approvals/changes-requested/pending reviewers, select pending names, compose a normalized PR object, append to varAllPRs
Filter Awaiting Review / Approved Ready / Changes Requested All / Stale PRs
Filter array (Query)Split the accumulated list into the four reported buckets
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_BitbucketWorkspace | String | your-workspace | Workspace/account that owns the repos |
| flowlibs_BitbucketRepoSlugs | String | repo-one,repo-two | Comma-separated repo slugs to scan |
| flowlibs_StalePrThresholdDays | String | 5 | Age (days) at which a PR is flagged stale |
| flowlibs_TeamsGroupId | String | <your-team-id> | Target Teams team (group) ID (reused) |
| flowlibs_TeamsChannelId | String | <your-channel-id> | Target Teams channel ID (reused) |
| flowlibs_DigestRecipientEmail | String | alerts@yourcompany.com | Email recipient for the digest (reused) |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Bitbucket | shared_bitbucket | ListPullRequests |
| Microsoft Teams | shared_teams | PostMessageToConversation |
| Office 365 Outlook | shared_office365 | SendEmailV2 |
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.
- Pick the repos
- Set flowlibs_BitbucketRepoSlugs to your comma-separated repo slugs and flowlibs_BitbucketWorkspace to your workspace.
- Change the schedule
- Edit the Recurrence trigger (default daily 08:00 ET).
- Tune staleness
- Raise/lower flowlibs_StalePrThresholdDays.
- Re-target delivery
- Update flowlibs_TeamsGroupId / flowlibs_TeamsChannelId / flowlibs_DigestRecipientEmail.
- Go live
- Authorize the Bitbucket, Teams, and Outlook connections, then turn the flow On.
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.01Open PR age (days)
Computes how many whole days a PR has been open.
EXPR.02Category
Derives the PR's review-state category from its participants.
EXPR.03Is stale
True when a PR's age meets the staleness threshold.
EXPR.04Pending reviewers
Comma-joins the names of reviewers who still owe a review.
EXPR.05Table rows unwrap (Select object-form to string)
Flattens the Select object array into raw HTML table rows.
Customize & download
Generate a ready-to-import copy of this solution with your environment-variable values baked in — available on Base, Pro, or Team.
Upgrade to customize
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.