Docs Change Watcher
Every 15 minutes lists files under /docs in a repo, compares SHAs against a cached snapshot; if any doc changed, posts the file name and author in a Teams 'docs-changes' 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
Every 15 minutes this flow lists every file under a configurable path inside a GitHub repository (default /docs), compares each file's SHA against a cached snapshot held in a SharePoint list, and posts a notification to a Microsoft Teams channel for every file that is new or has a changed SHA. The same iteration upserts the SharePoint snapshot so the next poll only alerts on the next change. Built on the HTTP action — not the GitHub connector — because the connector does not expose a list-files-from-a-path operation.
Use Case
Documentation drifts silently — engineers ship code, edit READMEs, and the docs team finds out a sprint later in standup. This flow gives the docs team a near-real-time feed of every change inside a watched path, so reviews happen while the change is still fresh and the original author is still in context.
The flow is ideal for teams that:
- 15-minute detection latency on doc adds and edits.
- Zero false positives — SHA comparison only alerts on actual content change.
- Snapshot lives in SharePoint, so history is auditable and editable by hand.
- One env var (flowlibs_DocsWatcherPath) re-targets the watcher at any folder.
- HTTP action sidesteps the GitHub connector's missing list-from-path operation.
Flow Architecture
Recurrence — every 15 minutes
TriggerPolls the watched repo path on a 15-minute cadence.
Initialize 8 variables
InitializeVariableOne per env var: varOwner, varRepo, varToken, varPath, varSiteUrl, varListName, varTeamsGroup, varDocsChannel.
List_Repo_Path
HTTPGET /repos/{owner}/{repo}/contents/{path} with Authorization: Bearer <PAT>, Accept: application/vnd.github+json, User-Agent header, X-GitHub-Api-Version.
Filter_Files_Only
QueryKeeps items where type == 'file' — directories are skipped.
Get_Existing_Snapshot
SharePoint GetItemsGetItems on flowlibs_DocsSnapshotListName with top=5000.
Apply_to_each_File
Foreach (3 actions)Inner: Find_In_Snapshot (Query — match Title == path) → If_SHA_Changed (true posts Teams message + nested If_Row_Exists upserts SharePoint via PatchItem or PostItem).
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_GitHubOwner | String | — | GitHub org or user that owns the watched repo. |
| flowlibs_GitHubRepository | String | — | Repository name within that owner. |
| flowlibs_GitHubApiToken | String | — | PAT with `repo` scope used as bearer in the HTTP action. |
| flowlibs_DocsWatcherPath | String | docs | Folder inside the repo to watch. |
| flowlibs_SharePointSiteURL | String | — | SharePoint site that hosts the snapshot list. |
| flowlibs_DocsSnapshotListName | String | FlowLibs - Docs SHA Snapshot | SharePoint list used as SHA cache. |
| flowlibs_TeamsGroupId | String | — | Team GUID that owns the docs-changes channel. |
| flowlibs_TeamsDocsChannelId | String | — | Channel ID inside that team for change notifications. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| HTTP | shared_http | GET (lists files in the watched directory) |
| SharePoint | shared_sharepointonline | GetItems PatchItem PostItem |
| Teams | shared_teams | PostMessageToConversation (drops the change alert into the docs channel) |
| GitHub | shared_github | (connection ref only) (shipped for future operations; HTTP does today's listing) |
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.
- Watch multiple paths
- Replace flowlibs_DocsWatcherPath with a JSON array env var and Foreach over each path before the snapshot lookup.
- Add deletion alerts
- After the file loop, query the snapshot for any rows whose Title is no longer in the latest GitHub listing and post a 'doc removed' Teams card.
- Tighter cadence
- Drop Recurrence to 5 minutes for active docs repos — be aware of GitHub rate limits with large /docs trees.
- Slack instead of Teams
- Swap PostMessageToConversation for the Slack PostMessage action and replace the two Teams env vars with a Slack channel ID.
- Adaptive cards
- Replace the HTML Teams message with a Teams adaptive card containing file path, author, and a 'Review' button.
- Per-author routing
- Pull the latest commit author from the GitHub commit API and route changes to the doc owner's DM in addition to the channel.
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.01Build GitHub list-contents URL
Concatenates the owner, repo, and path env vars into the contents endpoint.
EXPR.02Filter to files only
Excludes directories from the contents listing.
EXPR.03Stored SHA fallback (new vs changed)
Returns _NEW_ when the file is not in the snapshot.
EXPR.04SHA changed test
Decides whether to post and upsert.
EXPR.05Decide upsert path
Picks PatchItem vs PostItem based on whether the row already exists.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.