Path Based Sync
Path-based sync allows teams to connect one GitHub repository to multiple Slack channels and create regex-based rules to create routing paths for Pull Requests. Designed for mono-repos, it gives admins the flexibility to route PRs to project-specific channels based using priority-based rule-matching on file paths in the pull request.
Why use path-based sync?
- Automatically sync PRs to project-specific channels.
- Monitor multiple projects within a single repository while creating team-specific channels for communication.
- Reduce noise by routing PR updates only to those channels that need to see them.
Important: Path-based sync monitors the entire repository but routes the PR based on the first match of the path regex. All subsequent updates to the PR (even if files in other paths are changed in the future commits) will remain routed to the same channel.
How to use the path connector feature
1. Add the Pullflow bot to your Slack channel
To begin using path-based sync, invite the Pullflow bot to the relevant Slack channel:
This will open the configuration options for setting up GitHub repository updates in the Slack channel. When you invite the bot to the channel, selecting a repository in the configuration dialog is not required before using the connect command. If the configuration dialog appears, you can simply cancel it and proceed to use the connect command directly to set up path-based routing for PR updates.
If you’d like to explore additional configuration options, you can refer to this documentation.
2. Connect specific paths within a repository
Note: Ensure that your command has the correct spacing between the repository and the path (e.g. /pullflow connect {organization}/{repository} /path).
Connect a subfolder path:
Use the following syntax:
Example:
This command ensures that any PRs changing files in the src/components
folder will notify the configured Slack channel.
Connect a specific file:
If a PR changes a specific file, updates will route to the channel configured for that file.
Note: This configuration will prioritize notifications for the channel linked to this file and may prevent notifications from being sent to other channels.
Example:
Connect the entire repository:
For complete repository coverage, use the following command, and then connect your GitHub repository:
Managing your connections
View connected paths
To view a list of all paths currently connected to the Slack channel:
Understanding the output:
The output will list all repositories and their connected paths, along with the channel routing priority.
Priority matters: Paths are ordered by priority. If a PR matches multiple paths, the first path match will determine where the PR is routed. Newer paths take higher priority. For example, if you add
/some-folder/.*
and later add/.*/
, the PR will be routed to the everything path(/.*/)
. To adjust the priority, you must disconnect and reconnect the paths in the required order.
Subsequent PR updates will continue to route to the same channel, even if additional files in other paths are changed.
Example scenario:
Repository: myOrg/myRepo
Paths in decreasing priority:
If a PR modifies two files:
- src/files/fileA.txt
- src/pages/pageB.txt
The PR will route to the channel linked to /src/.*
because it has the highest priority. Other channels will not receive notifications, even if their paths match.
Reading the path output:
- No ▶︎ symbol: Path connected to the current Slack channel.
- ▶︎ symbol: Path connected to a different channel.
Example from the image, in this case:
- Changes in
PaidPaper/public-4 /src/fileA.py
→ Notify current channel (matches/src/.*
). - Changes in
PaidPaper/public-4 /fileB.py
→ Notify different channel (matches▶︎ /.*
). - Changes in
PaidPaper/public-6 /fileC.py
→ Notify different channel (matches▶︎ /.*
first). - Changes in
PaidPaper/richards /fileD.py
→ Notify current channel (matches/.*
).
Disconnect a repository path
To stop receiving notifications for a specific path, use the disconnect command:
Example:
This removes the path from the Slack channel, preventing further notifications.
Summary
- Add the bot: Invite the Pullflow bot to your Slack channel using /invite @pullflow.
- Connect paths: Use /pullflow connect to link specific paths to Slack channels for targeted notifications.
- View connections: Run /pullflow list to see connected paths and their priorities.
- Disconnect paths: Use /pullflow disconnect to remove any unnecessary path configurations.