GitHub App Install - Auto-Add New Repo
When a new Repo record is created in Dataverse, the flow calls Add Selected Repository To An Installation so CI/CD bots and Copilot tooling get immediate access without a manual sync step.
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 FlowLibs demo is an event-driven bridge between Dataverse and GitHub. When a new repo record is created in the flowlibs_githubrepo table, the flow fires a repository_dispatch event to an orchestrator repo so a GitHub Actions workflow can add the repo to a specific GitHub App installation — then notifies the team in Microsoft Teams.
The architecture uses a dispatch-event pattern because the GitHub connector does not expose AddSelectedRepositoryToInstallation directly. Instead of falling back to raw HTTP + PAT, the flow stays native-connector by dispatching a typed event that the orchestrator workflow handles with GitHub App credentials.
Use Case
Teams that maintain dozens of repos and use a GitHub App with *Selected repositories* installation scope have to manually check new repos into the app's repo list every time. Easy to forget. Causes broken CI, missing bot reviews, and "why is Copilot not working on this repo?" questions. This flow keeps the App's repo list in sync the moment a repo is registered in Dataverse — your source of truth.
The flow is ideal for teams that:
- Teams running GitHub Apps with the *Selected repositories* installation scope.
- Orgs that already use Dataverse as the source of truth for tracked repositories.
- Want connector-first design — no PATs or raw HTTP credentials in the flow.
- Need an audit trail in Teams of when each repo was registered.
Flow Architecture
When a New Repo Is Added in Dataverse
Dataverse SubscribeWebhookTriggerTriggers on row create in flowlibs_githubrepo (scope=Organization).
Init 6 variables
InitializeVariablevarOrchestratorOwner, varOrchestratorRepo, varEventType, varInstallationId, varTeamsGroupId, varTeamsChannelId — all from env vars.
Get New Repo Row
Dataverse GetItemRe-fetches the row by ID to expand all columns (the trigger payload is shallow).
Dispatch Add Repo To Installation Event
GitHub CreateRepositoryDispatchEventFires a typed event to the orchestrator repo with client_payload containing installation_id + repo details.
Notify Teams Channel Of Dispatch
Teams PostMessageToConversationPosts an HTML card summarizing the dispatch.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_GitHubOrchestratorOwner | String | — | Org/user that owns the orchestrator repo. |
| flowlibs_GitHubOrchestratorRepo | String | — | Name of the orchestrator repo. |
| flowlibs_DispatchEventType | String | add-repo-to-installation | Custom event_type value matched by the orchestrator workflow. |
| flowlibs_GitHubAppInstallationId | String | — | GitHub App installation ID to target. |
| flowlibs_TeamsGroupId | String | — | Teams team/group ID. |
| flowlibs_TeamsChannelId | String | — | Teams channel ID. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Dataverse | shared_commondataserviceforapps | SubscribeWebhookTrigger GetItem |
| GitHub | shared_github | CreateRepositoryDispatchEvent (fires typed dispatch to orchestrator repo) |
| 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.
- Swap Teams for Slack/Email
- Replace Notify_Teams with Slack PostMessage or Outlook SendEmailV2.
- Route multiple App installations
- Add a choice column on the Dataverse table and a Switch that sets varInstallationId based on the selected env (Dev/Prod).
- Gate by branch policy compliance
- Add a GitHub SearchIssues qualifier check before dispatching to verify the repo meets org standards.
- Update Dataverse on success
- After dispatch, call UpdateRecord to set flowlibs_addedtoinstallation = true (add the column first).
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.01Trigger output (record ID)
Picks up the new row's primary key.
EXPR.02Re-fetched row fields
Reads expanded columns after Get New Repo Row.
EXPR.03Env var read
Standard pattern for hydrating a variable from an env var.
EXPR.04Repository dispatch payload
Structured JSON merging variables into client_payload.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.