fix(ci): remove secret env from agent market watch
All checks were successful
Code Review / ai-code-review (push) Successful in 14s

This commit is contained in:
Your Name
2026-06-04 21:59:35 +08:00
parent cfb866d055
commit e73383c326

View File

@@ -496,11 +496,9 @@ jobs:
print(json.dumps(summary, ensure_ascii=False, sort_keys=True))
PY
- name: Notify Telegram on actionable change or failure
- name: Summarize actionable change or failure
if: always()
env:
TG_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
OPENCLAW_TG_BOT_TOKEN: ${{ secrets.OPENCLAW_TG_BOT_TOKEN }}
TG_CHAT_ID: ${{ env.TELEGRAM_ALERT_CHAT_ID }}
JOB_STATUS: ${{ job.status }}
CANDIDATE_COUNT: ${{ steps.watch.outputs.candidate_count }}
@@ -533,22 +531,11 @@ jobs:
exit 0
fi
TOKEN="${TG_BOT_TOKEN:-${OPENCLAW_TG_BOT_TOKEN:-}}"
if [ -z "$TOKEN" ] || [ -z "${TG_CHAT_ID:-}" ]; then
echo "Telegram secret missing; skip market watch notification."
exit 0
fi
python3 - <<'PY'
import os
import urllib.parse
import urllib.request
from datetime import datetime
from html import escape
from zoneinfo import ZoneInfo
token = os.environ.get("TG_BOT_TOKEN") or os.environ.get("OPENCLAW_TG_BOT_TOKEN")
chat_id = os.environ.get("TG_CHAT_ID", "")
status = os.environ.get("JOB_STATUS", "unknown")
changed = os.environ.get("CHANGED_CANDIDATES") or "0"
queue = os.environ.get("INTEGRATION_QUEUE_COUNT") or "0"
@@ -571,31 +558,24 @@ jobs:
generated = datetime.now(ZoneInfo("Asia/Taipei")).strftime("%Y-%m-%d %H:%M")
title = "Agent Market Watch 需要複核" if status == "success" else "Agent Market Watch 執行失敗"
message = (
f"<b>[{escape(title)}]</b>\n"
f"時間:<code>{escape(generated)}</code>\n"
f"狀態:<code>{escape(status)}</code>\n"
f"候選:<code>{escape(candidates)}</code>;來源:<code>{escape(sources)}</code>\n"
f"變動候選:<code>{escape(changed)}</code>;整合佇列:<code>{escape(queue)}</code>;來源失敗:<code>{escape(failures)}</code>\n\n"
f"Review已審 <code>{escape(reviewed)}</code>;擋下整合 <code>{escape(blocked)}</code>;成本批准需求 <code>{escape(cost_approvals)}</code>;依賴批准需求 <code>{escape(dependency_approvals)}</code>\n\n"
f"Discoveryunique repo <code>{escape(discovery_repos)}</code>;需人工分類 <code>{escape(discovery_manual)}</code>;新未分類 <code>{escape(discovery_new)}</code>;已分類 <code>{escape(classified_repos)}</code>;建議 watch <code>{escape(recommended_watch_additions)}</code>\n\n"
f"Promotionscorecard prescreen eligible <code>{escape(watch_promotion_eligible)}</code>priority upgrade approved <code>{escape(watch_promotion_approved)}</code>replay approved <code>{escape(replay_candidates_approved)}</code>\n\n"
"政策:此 workflow 只建立市場觀察、整合審查、discovery intake/classification 訊號,不批准 SDK 安裝、付費 API、replay、shadow/canary 或 OpenClaw 取代。\n"
f"Log{escape(actions_url)}"
)
payload = urllib.parse.urlencode(
{
"chat_id": chat_id,
"text": message,
"parse_mode": "HTML",
"disable_web_page_preview": "true",
}
).encode()
request = urllib.request.Request(
f"https://api.telegram.org/bot{token}/sendMessage",
data=payload,
method="POST",
)
with urllib.request.urlopen(request, timeout=10) as response: # noqa: S310
response.read()
lines = [
f"## {title}",
"",
f"- 時間:`{generated}`",
f"- 狀態:`{status}`",
f"- 候選 / 來源:`{candidates}` / `{sources}`",
f"- 變動候選 / 整合佇列 / 來源失敗:`{changed}` / `{queue}` / `{failures}`",
f"- Review已審 `{reviewed}`;擋下整合 `{blocked}`;成本批准需求 `{cost_approvals}`;依賴批准需求 `{dependency_approvals}`",
f"- Discoveryunique repo `{discovery_repos}`;需人工分類 `{discovery_manual}`;新未分類 `{discovery_new}`;已分類 `{classified_repos}`;建議 watch `{recommended_watch_additions}`",
f"- Promotionscorecard prescreen eligible `{watch_promotion_eligible}`priority upgrade approved `{watch_promotion_approved}`replay approved `{replay_candidates_approved}`",
"",
"政策:此 workflow 只建立市場觀察、整合審查、discovery intake/classification 訊號,不批准 SDK 安裝、付費 API、replay、shadow/canary 或 OpenClaw 取代。",
f"Log{actions_url}",
]
summary = "\n".join(lines) + "\n"
print(summary)
step_summary_path = os.environ.get("GITHUB_STEP_SUMMARY")
if step_summary_path:
with open(step_summary_path, "a", encoding="utf-8") as handle:
handle.write(summary)
PY