ci: add stale issues checker
Some checks failed
Lint & Format / detect (push) Has been cancelled
Lint & Format / js-lint (push) Has been cancelled
Lint & Format / py-lint (push) Has been cancelled
Lint & Format / sh-lint (push) Has been cancelled
Lint & Format / go-lint (push) Has been cancelled
Monorepo Lint / lint-shell (push) Has been cancelled
Monorepo Lint / lint-js (push) Has been cancelled

This commit is contained in:
2026-03-14 19:00:21 -05:00
parent 7a7949712b
commit d3dd50afef

View File

@@ -0,0 +1,37 @@
name: Stale Issues
on:
schedule:
- cron: '0 3 * * 1'
workflow_dispatch:
jobs:
stale:
runs-on: ubuntu-latest
steps:
- name: Check stale issues
run: |
GITEA="https://git.blackroad.io"
TOKEN="${{ secrets.ADMIN_TOKEN }}"
REPO="${{ github.repository }}"
# Find issues older than 30 days with no activity
CUTOFF=$(date -u -d '30 days ago' +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -u -v-30d +%Y-%m-%dT%H:%M:%SZ)
echo "Checking for stale issues (no activity since $CUTOFF)..."
# List open issues
ISSUES=$(curl -s "$GITEA/api/v1/repos/$REPO/issues?state=open&type=issues&sort=updated&limit=50" \
-H "Authorization: token $TOKEN")
echo "$ISSUES" | python3 -c "
import sys, json
from datetime import datetime, timedelta
cutoff = datetime.utcnow() - timedelta(days=30)
issues = json.load(sys.stdin)
stale = [i for i in issues if datetime.fromisoformat(i['updated_at'].rstrip('Z')) < cutoff]
print(f'Found {len(stale)} stale issues')
for i in stale:
print(f' #{i[\"number\"]}: {i[\"title\"]} (updated {i[\"updated_at\"]})')
" 2>/dev/null || echo "No stale issues found"