Files
Arcrun/registry/examples/github-issue-bot/workflow.yaml
T
Leo e8bd518efa D36 第0步:範例 workflow 金鑰統一走 credential(止血——範例是用戶照抄的樣板)
改前四種寫法並存、沒一個是 credential,而執行端只認 {{credential.X}}
(graph-executor.ts:247→resolveCredentialRefs)⇒ 用戶照抄必踩坑:
  {{api_key}} 13/{{gitea_token}} 2/{{secret.GITHUB_BOT_TOKEN}} 2/{{kbdb_api_key}} 1

改後(19 處統一):
  {{credential.arcrun_namespace}} 15/{{credential.gitea_token}} 2/{{credential.github_bot_token}} 2

⚠️ 中途修正一次錯誤命名:我先改成 kbdb_partner_key(照零件契約舊敘述 ak_xxx),
leo 當場指正「現在沒有 partner key,改用 namespace,沒有發 API key 的機制」——
實際機制確為 X-Arcrun-API-Key: <namespace>(實例上活的 workflow 為證)。

不動:{{secret.LEO_TELEGRAM_CHAT_ID}} 3 處——chat_id 是聊天室 ID 不是金鑰,
無腦套規則會引進「找不到 credential」的錯誤。

驗:違規寫法歸零/12 個範例 YAML 全可解析。
殘:kbdb_upsert_block 契約仍寫『KBDB partner key(ak_xxx)』=假資訊源(我就是被它騙的),
修它被 component-guard 擋(正確),需 leo 跑 scripts/component-arm.sh。
2026-07-29 19:33:46 +08:00

52 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: github_issue_bot
description: GH webhook 收新 issue → claude 分析 → 自動留 comment + 加 label
flow:
- "input >> ON_SUCCESS >> analyze"
- "analyze >> ON_SUCCESS >> add_comment"
- "add_comment >> ON_SUCCESS >> add_labels"
config:
analyze:
component: claude_api
timeout_ms: 30000
_recipe_output_format: json
_recipe_output_required_fields:
- severity
- category
- first_response
prompt: |
你是 GitHub issue 第一線分流員。對下列 issue 給出:
- severity: "critical" | "high" | "medium" | "low"
- category: "bug" | "feature" | "doc" | "question" | "other"
- first_response: 一段 markdown,禮貌、有用、不假裝是真人
若是 bugguide 用戶提供 reproduce steps;若 question 直接回答;
若 feature 引導去 discussion;若 doc 直接收。
Issue:
Title: {{input.issue.title}}
Body: {{input.issue.body}}
add_comment:
component: http_request
url: "https://api.github.com/repos/{{input.repository.full_name}}/issues/{{input.issue.number}}/comments"
method: POST
headers:
Authorization: "Bearer {{credential.github_bot_token}}"
Accept: "application/vnd.github+json"
body_json:
body: "{{analyze.first_response}}"
add_labels:
component: http_request
url: "https://api.github.com/repos/{{input.repository.full_name}}/issues/{{input.issue.number}}/labels"
method: POST
headers:
Authorization: "Bearer {{credential.github_bot_token}}"
body_json:
labels:
- "auto-triaged"
- "severity:{{analyze.severity}}"
- "type:{{analyze.category}}"