GenAiHub

Last checked 8 October 2026 — responded normally.

Report and clean up stale GitHub branches with Slack notifications

Quick Overview

Live
Open / InstallLast updated October 8, 2026

Description

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 Runs on a weekly schedule or when you manually execute the workflow. Loads configuration for the GitHub repo owner, repository list, stale age threshold, protected branch patterns, Slack channel, and deletion limits. For each configured repository, fetches all branches via the GitHub GraphQL API and fetches recently merged pull requests via the GitHub REST API. Classifies branches as protected (skipped), merged-but-not-deleted, or stale based on last commit date and the configured stale-days threshold. If auto-delete is enabled, deletes up to the configured maximum number of candidate branches in GitHub and compiles a success/failure summary. Formats and posts the cleanup report to Slack, and if deletions ran, posts a second Slack message with the deletion results. Setup 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. Create and add a Slack credential with permission to post messages (chat:write) and set the target channel in the configuration. Update the configuration values for repo owner, comma-separated repo list, staleDays, protectedBranches, reportOnly, and maxBranchesToDelete before activating the workflow. An n8n automation workflow template by Adriaan van Niekerk.

Community Metrics

Views
1
Avg Rating
N/A
Ratings
0
Likes
0
Comments
—

Author

Adriaan van Niekerk

Platform

web

Pricing model

free

Categories

  • Automation

Tags

  • n8n
  • workflow
  • http-request
  • slack
  • code

Capabilities

  • 3 nodes
  • 1 views

Information

TypeWorkflow
Sourcen8n
AddedJuly 27, 2026

Comments

?

Others in the same category, ranked by how often they are opened.