Skip to content

Weekly

Label and close stale issues every week

Issues with no activity for 60 days are labelled stale, closed 14 days later if nothing happens, and you get the list.

Runs
Weekly
Apps
GitHub
AI
Not needed
Access
Issues: read+write

Send this to your assistant

Create a ClickRuntime automation: every Monday, label issues in acme/app with no activity for 60 days as stale with a short comment, close issues that have been stale for 14 more days, and email me the list.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A repository that has been active for a couple of years accumulates hundreds of open issues that nobody is going to work on: bugs from versions long gone, questions that were answered in a comment and never closed, feature requests from users who left. The open count reaches 400, new contributors are discouraged, and genuine priorities disappear in the pile.

Each week, open issues are listed oldest-activity first. Those quiet for 60 days get a stale label and a polite comment asking whether it is still relevant, and issues that were already marked stale and stayed silent are closed. A summary email tells you what was labeled and what was closed.

Maintainers of mature open source projects and teams that treat GitHub issues as a working backlog tend to use it. It works for any project that has outgrown manual grooming.

What you get out of it

  • The issue count means something again

    A smaller list of live issues shows the real size of the work ahead, which makes it easier for contributors to find a worthwhile place to start. A manageable list also invites more contributions from people who were put off.

  • Reporters get a fair warning

    The stale comment gives people a chance to respond before closure, so a user who still cares can say so and the issue remains open with fresh information. Respectful notice keeps goodwill with the community while still getting work done.

  • Triage time shrinks

    Maintainers no longer re-read year-old threads at every planning session, because the dead ones are retired automatically and the remaining ones deserve attention. That time returns to fixing actual bugs and shipping features that matter.

  • Closed does not mean lost

    Closed issues stay searchable and can be reopened by anyone with a new reproduction, so tidying up never destroys the history that future bug reports rely on. Nothing of value is erased by the cleanup, only moved out of sight.

  • A weekly summary keeps you informed

    The email lists exactly what was labeled or closed, so you can spot a mistake quickly and reopen something that should have stayed, without auditing the whole backlog. Mistakes get reversed quickly and with very little effort.

How it works

What happens, step by step

  1. Once a week, the automation goes through the open issues in your GitHub repo, starting with the least recently updated.

  2. Issues with no activity for 60 days get a stale label and a comment saying they will close soon.

  3. Stale issues still quiet 14 days later are closed.

  4. You get an email listing what was marked stale and what was closed.

Before it runs live

  • Connect GitHub

What you get

RunsWeekly
Label and close stale issues every weektoday, 9:00Succeeded
Email · Stale issue clean-upMarked stale: #612 Dark mode flicker on load Closed: #540 Support IE11

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other GitHub steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
stale_issue_clean_up.pyexample
from datetime import datetime, timedelta, timezone
from clickruntime import on_trigger, credentials, http, notify

def gh(method, path, **kw):
    resp = http.request(method, f"https://api.github.com{path}", headers={
        "Authorization": f"Bearer {credentials.connection('github', 'work')}",
        "Accept": "application/vnd.github+json"}, **kw)
    resp.raise_for_status()
    return resp.json() if resp.content else None

REPO = "acme/app"

@on_trigger
def run(event):
    now = datetime.now(timezone.utc)
    age = lambda ts: now - datetime.fromisoformat(ts.replace("Z", "+00:00"))
    issues = [i for i in gh("GET", f"/repos/{REPO}/issues", params={"state": "open", "sort": "updated",
              "direction": "asc", "per_page": 100}) if "pull_request" not in i]
    marked, closed = [], []
    for i in issues:
        stale = any(l["name"] == "stale" for l in i["labels"])
        if stale and age(i["updated_at"]) > timedelta(days=14):
            gh("PATCH", f"/repos/{REPO}/issues/{i['number']}", json={"state": "closed", "state_reason": "not_planned"})
            closed.append(f"#{i['number']} {i['title']}")
        elif not stale and age(i["updated_at"]) > timedelta(days=60):
            gh("POST", f"/repos/{REPO}/issues/{i['number']}/labels", json={"labels": ["stale"]})
            gh("POST", f"/repos/{REPO}/issues/{i['number']}/comments",
               json={"body": "No activity for 60 days, so this is marked stale. It will close in 14 days unless there's an update."})
            marked.append(f"#{i['number']} {i['title']}")
    if marked or closed:
        notify.email_me("Stale issue clean-up", "Marked stale:\n" + "\n".join(marked or ["none"]) +
                        "\n\nClosed:\n" + "\n".join(closed or ["none"]))
    return {"marked": len(marked), "closed": len(closed)}

FAQ

Common questions

Can I exempt issues from being closed?
Yes. Issues with a label such as pinned, security or help wanted can be skipped so they never get marked stale. Tell your AI assistant which labels to protect and approve the change before it runs.
How is inactivity measured?
It uses the issue's last update time, which includes comments, label changes and edits. Any new comment resets the clock, so a reply to the stale warning keeps an issue open. The 60 day period is adjustable.
Does it touch pull requests?
GitHub lists pull requests alongside issues, so the automation filters them out and acts only on real issues. If you also want stale pull requests handled, that can be added as a separate rule with different timing.
What permissions does it need?
Issues: read+write. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (weekly). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Label and close stale issues every week” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.