Out-of-Office Reviewer Removal
Each morning reads Outlook automatic replies for all reviewers; if a reviewer is OOO, calls Remove Requested Reviewer on their pending PRs and reassigns their backup based on a SharePoint mapping.
Overview
Scheduled flow that automatically re-routes GitHub code review assignments whenever a primary reviewer has an active Outlook out-of-office message. Every morning at 09:00 UTC, reads a SharePoint list mapping primary→backup reviewers, checks each primary reviewer's mailbox for an active auto-reply, and — if OOO — removes them as requested reviewer on their open PRs and assigns the configured backup. Backup is notified by email; an IT admin summary email reports the day's reassignments.
**Flow ID:** 73b49943-413b-f111-88b3-0022480c05ea • **State:** Stopped (Off)
Use Case
Engineering teams pay a tax every time a reviewer goes on vacation: PRs sit untouched until somebody manually reassigns. This flow eliminates manual intervention by treating Outlook auto-reply status as the source of truth for reviewer availability and pairing it with a static backup mapping.
Typical payoff: 30–45 reviewer-week reassignments annually for a 15-reviewer team without engineering effort, keeping PR throughput steady during holidays.
Flow Architecture
Trigger: **Recurrence_Daily_At_9AM_UTC** (daily, 09:00 UTC).
1. Init 6 vars (SP site, list title, GitHub owner, notification sender, IT admin, reassignment log)
2. **Get_Reviewer_Backup_Mapping_From_SharePoint** (GetItems with `IsActive eq 1`)
3. **Apply to each Reviewer** (outer Foreach):
- Get_MailTips_For_Reviewer (Office 365 GetMailTips_V2 with `automaticReplies`)
- Check_If_Reviewer_Is_OOO (If on length of automaticReplies.message)
- True: Search_For_Open_Pull_Requests_Requesting_Review (GitHub SearchIssues with `review-requested:{login} user:{org}`)
- Apply to each Pending PR: RemoveReviewers + RequestReviewers (backup) + Append log entry
- Notify_Backup_Reviewer_Of_New_Assignments (Outlook SendEmailV2)
4. **Send_Daily_Summary_Email_To_IT_Admin** (Outlook SendEmailV2)Environment Variables
| Variable | Schema Name | Type | Default | Purpose |
|---|---|---|---|---|
| SharePoint Site URL | flowlibs_SharePointSiteURL | String | (none) | Root SharePoint site hosting FlowLibs lists |
| OOO Reviewer List Title | flowlibs_OOOReviewerListTitle | String | OOOReviewerMapping | SharePoint list mapping primary→backup reviewers |
| GitHub Org Or User | flowlibs_GitHubOrgOrUser | String | (none) | GitHub owner whose PRs the flow manages |
| Notification Sender Email | flowlibs_NotificationSenderEmail | String | (none) | Mailbox used to send OOO backup notifications |
| IT Admin Email | flowlibs_ITAdminEmail | String | (none) | Administrator mailbox for the daily summary |
Connectors & Connections
| Connector | API Name | Connection Format | Usage |
|---|---|---|---|
| SharePoint Online | shared_sharepointonline | shared-sharepointonl-bc6f6eff-... | GetItems — read reviewer mapping |
| Office 365 Outlook | shared_office365 | shared-office365-ab123aff-... | GetMailTips_V2 + SendEmailV2 (×2) |
| GitHub | shared_github | b2585b1b8da6406cbb41ba7c48f66af5 | SearchIssues + RemoveReviewersPullRequest + RequestReviewersPullRequest |
Customization Guide
1. Create the SP list OOOReviewerMapping with PrimaryReviewer{Email,Login,Name}, BackupReviewer{Email,Login,Name}, IsActive columns.
2. Set 5 env vars; bind 3 connection refs; turn on.
**Common Modifications:** change schedule (Hour interval=4 for 4-hr polling); filter to specific repos via repo:org/repo-a; expand to Microsoft Teams via PostMessageToChannel; multi-level fallback (tertiary reviewer); suppress self-OOO.
Key Expressions
- length(coalesce(body('Get_MailTips_For_Reviewer')?['value']?[0]?['automaticReplies']?['message'], '')) > 0 — OOO detection
- concat('is:pr is:open review-requested:', items('Apply_to_each_Reviewer')?['PrimaryReviewerLogin'], ' user:', variables('varGitHubOrgOrUser')) — server-side PR search
- last(split(items('Apply_to_each_Pending_PR')?['repository_url'], '/')) — repo name from API URL