Templates / Report and clean up stale GitHub branches with Slack notifications

Report and clean up stale GitHub branches with Slack notifications

Ready for 3.0

by Adriaan van Niekerk ✓ · 14 views · created 2026-06-09 · DevOps

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This workflow has 14 nodes and runs on a schedule (every week) (plus 1 other trigger). Along the way it connects Slack. It also calls api.github.com over HTTP.

How it runs

Trigger: On a schedule (every week) (plus 1 other trigger).

  1. Configuration (Edit Fields (Set)): sets 7 fields: repoOwner, scanRepos, staleDays…
  2. Expand Repo List (Code): runs custom JavaScript code
  3. Fetch All Branches (HTTP Request): calls api.github.com (POST)
  4. Fetch Recently Merged PRs (HTTP Request): calls an HTTP API
  5. Classify Branches — Merged vs Stale (Code): runs custom JavaScript code
  6. Auto-Delete Enabled? (If): checks a condition and branches into true / false
  7. Split Branches for Deletion (Code): runs custom JavaScript code
  8. Format Cleanup Report (Code): runs custom JavaScript code
  9. Delete Single Branch (HTTP Request): calls an HTTP API (DELETE)
  10. Send Report to Slack (Slack): uses Slack

…plus 2 more steps. See the full node list below.

Services it uses

Slack

HTTP calls to: api.github.com

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Nodes used (7)

From the author

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…

Excerpt from Adriaan van Niekerk's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.