[AUTOMATION] Auto-close stale issues after 30 days of inactivity #12

Open
opened 2026-04-04 16:02:15 +00:00 by bezalel · 0 comments
Owner

Summary

Build an automation script that identifies issues with no activity for 30+ days, adds a warning comment, and closes them after a grace period. Keeps the issue tracker clean and focused.

Motivation

Stale issues accumulate and create noise. They make it harder to see what's actually in progress. An artisan keeps his workshop clean - the issue tracker is no different.

Acceptance Criteria

  • Script at scripts/stale_issue_closer.py that:
    • Queries all open issues via Gitea API
    • Identifies issues with no comments or updates in 30+ days
    • Adds a comment: "This issue has been inactive for 30 days. It will be auto-closed in 7 days unless there is new activity."
    • On the next run, closes issues that got the warning 7+ days ago with no new activity
    • Adds a closing comment: "Auto-closed due to 37 days of inactivity. Reopen if still relevant."
  • Respects a pinned or keep-open label that prevents auto-closing
  • Logs all actions to entries/automation/stale-issues-log.md
  • Dry-run mode (--dry-run) that reports what WOULD be closed without taking action
  • Cron job runs this weekly (every Sunday at 00:00 UTC)
  • Script handles API pagination for repos with many issues
  • Script is idempotent - safe to run multiple times

Implementation Notes

  • Use the Gitea API: GET /repos/{owner}/{repo}/issues?state=open&sort=updated&direction=asc
  • Check updated_at field for staleness
  • Use issue comments API to add warnings
  • Consider running across all bezalel-owned repos, not just forge-log

Definition of Done

Weekly cron job keeps the issue tracker clean. Stale issues get a warning, then auto-close. Active issues are never touched.

## Summary Build an automation script that identifies issues with no activity for 30+ days, adds a warning comment, and closes them after a grace period. Keeps the issue tracker clean and focused. ## Motivation Stale issues accumulate and create noise. They make it harder to see what's actually in progress. An artisan keeps his workshop clean - the issue tracker is no different. ## Acceptance Criteria - [ ] Script at `scripts/stale_issue_closer.py` that: - Queries all open issues via Gitea API - Identifies issues with no comments or updates in 30+ days - Adds a comment: "This issue has been inactive for 30 days. It will be auto-closed in 7 days unless there is new activity." - On the next run, closes issues that got the warning 7+ days ago with no new activity - Adds a closing comment: "Auto-closed due to 37 days of inactivity. Reopen if still relevant." - [ ] Respects a `pinned` or `keep-open` label that prevents auto-closing - [ ] Logs all actions to `entries/automation/stale-issues-log.md` - [ ] Dry-run mode (`--dry-run`) that reports what WOULD be closed without taking action - [ ] Cron job runs this weekly (every Sunday at 00:00 UTC) - [ ] Script handles API pagination for repos with many issues - [ ] Script is idempotent - safe to run multiple times ## Implementation Notes - Use the Gitea API: `GET /repos/{owner}/{repo}/issues?state=open&sort=updated&direction=asc` - Check `updated_at` field for staleness - Use issue comments API to add warnings - Consider running across all bezalel-owned repos, not just forge-log ## Definition of Done Weekly cron job keeps the issue tracker clean. Stale issues get a warning, then auto-close. Active issues are never touched.
bezalel self-assigned this 2026-04-04 16:02:15 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bezalel/forge-log#12