Skip to content

Maintainer Tools

Automated repository maintenance — stale management, branch cleanup, settings sync, and comment commands.

Overview

The Maintainer pillar runs scheduled jobs to keep your repositories healthy:

FeatureScheduleDescription
Stale ScannerConfigurableWarn and close stale issues/PRs
Branch CleanupOn demandDelete merged branches
Comment CommandsEvent-driven/gitwire commands in comments
Settings APIOn demandRead/update repo settings
Governance SyncOn syncMembers, collaborators, branch rules
mermaid
graph LR
    CRON[Scheduler] --> SS[Stale Scanner]
    CRON --> BC[Branch Cleanup]
    GH[GitHub Webhook] --> CC[Comment Commands]
    SYNC[Sync Worker] --> GOV[Governance Sync]
    SS -->|Warn/Close| REPO[Repository]
    BC -->|Delete Branch| REPO

Stale Management

How It Works

  1. Worker scans all open issues and PRs in configured repos
  2. Checks updated_at against the configured threshold
  3. If stale and not warned: posts a warning comment + adds stale label
  4. If already warned and past close threshold: closes the item
  5. Skips items with pinned or keep-alive labels
  6. Skips items created by bot accounts

Configuration

Per-repo settings via the maintainer_settings table:

SettingDefaultDescription
stale_issue_days60Days before an issue is marked stale
stale_pr_days30Days before a PR is marked stale
stale_warn_days7Days after warning before closing
cleanup_branchestrueWhether to auto-delete merged branches
enabledtrueEnable/disable maintainer features

Branch Cleanup

Finds branches that have been merged into the default branch and deletes them. Skips:

  • The default branch itself
  • Protected branches
  • Branches with open PRs

Comment Commands

See Comment Commands for the full reference.

Settings API

Read and update repository settings programmatically:

bash
# Get settings
curl https://gitwire.yourdomain.com/api/maintainer/owner/repo/settings \
  -H "Authorization: Bearer YOUR_API_KEY"

# Update settings
curl -X PATCH https://gitwire.yourdomain.com/api/maintainer/owner/repo/settings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"stale_issue_days": 90, "stale_pr_days": 45}'

API Endpoints (17 total)

MethodPathDescription
GET/api/maintainer/membersList all org members
POST/api/maintainer/members/syncSync members from GitHub
GET/api/maintainer/members/:loginGet specific member
GET/api/maintainer/collaboratorsList all collaborators
GET/api/maintainer/collaborators/:owner/:repoRepo collaborators
PUT/api/maintainer/collaborators/:owner/:repo/:loginUpdate collaborator
DELETE/api/maintainer/collaborators/:owner/:repo/:loginRemove collaborator
GET/api/maintainer/branch-rulesList all branch rules
GET/api/maintainer/branch-rules/:owner/:repoRepo branch rules
PUT/api/maintainer/branch-rules/:owner/:repo/:patternUpdate branch rule
GET/api/maintainer/auditAudit log entries
GET/api/maintainer/:owner/:repo/settingsRepo settings
PATCH/api/maintainer/:owner/:repo/settingsUpdate settings
GET/api/maintainer/:owner/:repo/actionsMaintainer actions log
GET/api/maintainer/:owner/:repo/statsRepo statistics
POST/api/maintainer/:owner/:repo/stale-scanTrigger stale scan
POST/api/maintainer/:owner/:repo/branch-cleanupTrigger branch cleanup

In This Section

Released under the MIT License.