Quick Overview This workflow runs weekly (or manually) to scan GitHub repositories for merged-but-not-deleted and stale branches, then posts a cleanup report to Slack and can optionally auto-delete a capped number of branches. How it works 1. Runs on a weekly schedule or when you manually execute the workflow. 2. Loads configuration for the GitHub repo owner, repository list, stale age threshold, protected branch patterns, Slack channel, and deletion limits. 3. For each configured repository, fe

Quick Overview This workflow runs weekly (or manually) to scan GitHub repositories for merged-but-not-deleted and stale branches, then posts a cleanup report to Slack and can optionally auto-delete a capped number of branches. How it works 1. Runs on a weekly schedule or when you manually execute the workflow. 2. Loads configuration for the GitHub repo owner, repository list, stale age threshold, protected branch patterns, Slack channel, and deletion limits. 3. For each configured repository, fetches all branches via the GitHub GraphQL API and fetches recently merged pull requests via the GitHub REST API. 4. Classifies branches as protected (skipped), merged-but-not-deleted, or stale based on last commit date and the configured stale-days threshold. 5. If auto-delete is enabled, deletes up to the configured maximum number of candidate branches in GitHub and compiles a success/failure summary. 6. Formats and posts the cleanup report to Slack, and if deletions ran, posts a second Slack message with the deletion results. Setup 1. Create and add GitHub credentials (fine-grained token or PAT) with access to list branches/PRs and permission to delete branches if you enable auto-delete. 2. Create and add a Slack credential with permission to post messages (chat:write) and set the target channel in the configuration. 3. Update the configuration values for repo owner, comma-separated repo list, staleDays, protectedBranches, reportOnly, and maxBranchesToDelete before activating the workflow.
Download the workflow JSON file after purchase.
Open n8n → click the menu → Import from File.
Select the downloaded JSON and import.
Set up credentials for each node that requires them.
Click Execute Workflow to test, then activate.
Setup guide included
Purchase to unlock the full step-by-step guide
No reviews yet
Be the first to buy and share your experience.
Leave a review
Sign in to share your experience with this workflow.
Create a free account to purchase workflows.
Need help setting this up?
Book a 3-hour live setup session with an Agility consultant.