#!/bin/bash # GitHub PAT expiry monitor - daily check PAT="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" CODE=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $PAT" "https://api.github.com/user" 2>/dev/null) if [ "$CODE" = "200" ]; then echo "[$(date)] PAT OK (HTTP $CODE)" >> /var/log/github-pat-check.log else echo "[$(date)] PAT EXPIRED (HTTP $CODE)" >> /var/log/github-pat-check.log curl -s "https://api.telegram.org/bot8544624912/sendMessage?chat_id=7605775322&text=URGENT:+GitHub+PAT+EXPIRED+(HTTP+$CODE)+Renew+NOW:+https://github.com/settings/tokens" > /dev/null # Create Blade task echo '{"id":"task_pat_renew","name":"GitHub PAT Renewal","type":"powershell","command":"Start-Process chrome https://github.com/settings/tokens","priority":10}' > /var/www/html/api/blade-tasks/pending/task_pat_urgent.json fi