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
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:
37
.gitea/workflows/stale-issues.yml
Normal file
37
.gitea/workflows/stale-issues.yml
Normal 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"
|
||||
Reference in New Issue
Block a user