Templates / Clean up stale GitHub repos, branches and pull requests with GitHub API

Clean up stale GitHub repos, branches and pull requests with GitHub API

Ready for 3.0

by Rodman · 0 views · created 2026-11-18 · 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-12-01.

📬 Weekly n8n 3.0 breakage alerts, free

What this workflow does

This workflow has 23 nodes and runs on a schedule (every day). Along the way it connects GitHub.

How it runs

Trigger: On a schedule (every day).

  1. Get repositories for an organization (GitHub): work with organization
  2. is_archived (If): checks a condition and branches into true / false
  3. Get pull requests of a repository (GitHub): get pull requests (repository)
  4. Get Branches (HTTP Request): calls an HTTP API
  5. Updated (Date & Time): formats or calculates dates
  6. If: checks a condition and branches into true / false
  7. Not default (Filter): keeps only the items that match a condition
  8. If: checks a condition and branches into true / false
  9. Get PR Events (HTTP Request): calls an HTTP API
  10. Days Since Last Updated (Date & Time): formats or calculates dates

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

Services it uses

GitHub

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 (6)

From the author

Quick overview This workflow runs on a schedule to maintain a GitHub organization by labeling inactive pull requests as stale and closing them later, deleting old non-default branches, and archiving repositories that have been inactive for 90+ days. How it…

Excerpt from Rodman'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.