Auto-Merge Dependabot Patch PRs
When a Dependabot PR passes all status checks, has at least one approval, and is a patch-version bump, the flow calls Merge A Pull Request and posts a confirmation to the Teams dependencies 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 safely auto-merges approved Dependabot patch-level (x.y.Z) pull requests and posts a confirmation message to a Teams channel. It runs on a 30-minute recurrence and uses the GitHub search API with qualifiers to find Dependabot PRs that are open, have at least one approving review, and have all required status checks passing.
Why it matters: Patch-level dependency bumps are almost always safe (bug fixes and security patches, no API changes). Manually merging them is tedious and creates review fatigue. Automating the patch tier lets your team focus reviewer attention on minor/major bumps where breaking changes are possible.
Use Case
Most patch bumps are approved quickly but sit in the PR queue because no one wants to be the one to click merge. This flow detects patch PRs that are already approved and have green CI, merges them, and announces the merge in Teams. Minor and major version bumps are deliberately ignored so humans still review them.
The flow is ideal for teams that:
- A team uses Dependabot to keep dependencies up to date.
- Most patch bumps are approved quickly but sit in the PR queue because no one wants to be the one to click merge.
- This flow detects patch PRs that are already approved + have green CI, merges them, and announces the merge in Teams.
- Minor and major version bumps are deliberately ignored so humans still review them.
Flow Architecture
Recurrence trigger
RecurrenceRuns every 30 minutes starting at a fixed ISO start time.
Initialize Variables (x7)
Initialize variableSets GitHubOwner, GitHubRepo, TeamsGroupId, TeamsChannelId, MergeMethod, BotLogin (all from environment variables), and MergedCount (Integer counter, seeded to 0).
Compose - Build GitHub Search Query
ComposeBuilds the qualifier string: `is:pr is:open review:approved status:success author:app/<BotLogin> repo:<Owner>/<Repo>`.
GitHub - Search issues and pull requests
SearchIssuesCalls SearchIssues with q=search query, sort=updated, order=desc, per_page=25.
Apply to each (candidate PR)
Apply to eachFor each item in `coalesce(body('Search_for_Approved_Dependabot_PRs')?['items'], body('Search_for_Approved_Dependabot_PRs')?['value'], createArray())`: parse the PR title, derive from/to major.minor, and decide whether to merge.
Compose - Title after "from "
Compose`split(items('For_Each_Candidate_PR')?['title'], 'from ')[1]` - isolates the version pair string from the PR title.
Compose - Version pair
Compose`split(outputs('Compose_Title_After_From'), ' to ')` - produces [fromVersion, toVersion].
Compose - From major.minor
ComposeJoins first two elements of `split(outputs('Compose_Version_Pair')[0], '.')` to produce the major.minor part of the from-version.
Compose - To major.minor
ComposeEnvironment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_GitHubOwner | String | <configure> | GitHub organization or user owning the repo (e.g. your-org). |
| flowlibs_GitHubRepo | String | <configure> | Repository name to monitor. |
| flowlibs_TeamsGroupId | String | <configure> | Microsoft 365 Group (Team) ID for the announcement channel. |
| flowlibs_TeamsChannelId | String | <configure> | Channel ID within the Team where merge confirmations will be posted. |
| flowlibs_DependabotMergeMethod | String | squash | GitHub merge method - one of `merge`, `squash`, or `rebase`. GitHub returns 422 for any other value. |
| flowlibs_DependabotBotLogin | String | dependabot | Dependabot bot login (usually `dependabot`). |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| GitHub | shared_github | SearchIssues MergePullRequest |
| Microsoft Teams | shared_teams | PostMessageToConversation |
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 target repo
- Update flowlibs_GitHubOwner and flowlibs_GitHubRepo environment variable values to point the flow at a different repository.
- Route announcements to a different Teams channel
- Update flowlibs_TeamsGroupId and flowlibs_TeamsChannelId to redirect the merge confirmation posts to another channel.
- Use a different merge method
- Set flowlibs_DependabotMergeMethod to one of merge, squash, or rebase. GitHub will reject any other value with a 422.
- Widen the scope beyond patch bumps
- Remove or relax the If_Is_Patch_Level_Bump condition. For example, merging minor bumps (e.g. 1.2.3 to 1.3.0) means keeping the from == to check OFF for the major segment only. Do not remove the review:approved status:success qualifiers - the flow relies on server-side approval + CI gating.
- Monitor multiple repos
- Duplicate the flow or refactor it to loop a comma-separated list of repos. The search query can be extended with multiple repo: qualifiers if they share a single owner.
- Change the scan interval
- Edit the Recurrence trigger frequency. GitHub search API is rate-limited (30 requests/minute authenticated), so intervals below 5 minutes risk throttling across concurrent flows.
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.01Search query (server-side filter)
Builds the GitHub search qualifier string from the bot login, owner, and repo variables.
EXPR.02Coalesce GitHub search result array
Handles swagger-typed `value` vs raw `items` so the Apply to each always receives an array.
EXPR.03Title parse - after "from "
Isolates the version pair (e.g. `1.2.3 to 1.2.4`) from the Dependabot PR title.
EXPR.04Patch-bump condition (And expression)
Only merges when the major.minor pair matches between from/to (i.e. the difference is in the patch digit), both segments are non-empty, and the title starts with 'Bump'.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.