A GitHub Actions stale workflow builder that generates a ready-to-commit stale.yml
using the official actions/stale@v9 action. It marks inactive issues and pull requests as
stale, then closes them after a grace period — unless they carry a label you have marked as
exempt. The result is a self-maintaining issue tracker that does not drown in abandoned tickets.
How it works
The generated workflow runs on a schedule (a cron expression in UTC) and can also be
triggered manually via workflow_dispatch. On each run, actions/stale scans open issues
and PRs and compares each item’s last-activity time against days-before-stale. Items
past that threshold get the stale label and a comment. A second timer, days-before-close,
counts forward from when the item became stale; once it elapses, the item is closed with a
closing comment.
Exempt labels short-circuit the whole process: an item with pinned, security, or any
label you list is never touched. The job declares issues: write and pull-requests: write
permissions so it can apply labels, comment, and close — operations a read-only token cannot
perform.
Tips and notes
- Keep
operations-per-runmodest on large repositories. The action burns API quota for every comment and label change, and a huge backlog can otherwise exhaust your hourly limit. - Set
days-before-closeto-1if you only want a stale label and a nudge, leaving the close decision to a human. - Run the workflow on
workflow_dispatchfirst to preview behavior before trusting the schedule — the action logs exactly which items it would mark or close. - Schedule it during off-peak UTC hours (for example
0 1 * * *) so the notification burst does not land in the middle of your team’s workday.