issue-triage.lock.yml 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464
  1. # gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"6480ab16e23cfedd92d84774e899406c0d199039dd952058c2e0938b338038cd","compiler_version":"v0.68.3","strict":true,"agent_id":"claude","agent_model":"MiniMax-M2.7"}
  2. # gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN","MINIMAX_API_KEY"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"373c709c69115d41ff229c7e5df9f8788daa9553","version":"v9"},{"repo":"actions/setup-node","sha":"53b83947a5a98c8d113130e565377fae1a50d02f","version":"v6.3.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba90f2186d7ad780ec640f364005fa24e797b360","version":"v0.68.3"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.20"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.20"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.2.19"},{"image":"ghcr.io/github/github-mcp-server:v0.32.0"},{"image":"node:lts-alpine"}]}
  3. # ___ _ _
  4. # / _ \ | | (_)
  5. # | |_| | __ _ ___ _ __ | |_ _ ___
  6. # | _ |/ _` |/ _ \ '_ \| __| |/ __|
  7. # | | | | (_| | __/ | | | |_| | (__
  8. # \_| |_/\__, |\___|_| |_|\__|_|\___|
  9. # __/ |
  10. # _ _ |___/
  11. # | | | | / _| |
  12. # | | | | ___ _ __ _ __| |_| | _____ ____
  13. # | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___|
  14. # \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \
  15. # \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/
  16. #
  17. # This file was automatically generated by gh-aw (v0.68.3). DO NOT EDIT.
  18. #
  19. # To update this file, edit the corresponding .md file and run:
  20. # gh aw compile
  21. # Not all edits will cause changes to this file.
  22. #
  23. # For more information: https://github.github.com/gh-aw/introduction/overview/
  24. #
  25. # 对新打开的 issue 进行分类、打标签,并路由到对应的处理工作流
  26. #
  27. # Resolved workflow manifest:
  28. # Imports:
  29. # - shared/engine.md
  30. # - shared/network.md
  31. #
  32. # Secrets used:
  33. # - GH_AW_GITHUB_MCP_SERVER_TOKEN
  34. # - GH_AW_GITHUB_TOKEN
  35. # - GITHUB_TOKEN
  36. # - MINIMAX_API_KEY
  37. #
  38. # Custom actions used:
  39. # - actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  40. # - actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  41. # - actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  42. # - actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
  43. # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  44. # - github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  45. #
  46. # Container images used:
  47. # - ghcr.io/github/gh-aw-firewall/agent:0.25.20
  48. # - ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20
  49. # - ghcr.io/github/gh-aw-firewall/squid:0.25.20
  50. # - ghcr.io/github/gh-aw-mcpg:v0.2.19
  51. # - ghcr.io/github/github-mcp-server:v0.32.0
  52. # - node:lts-alpine
  53. name: "Issue Triage"
  54. "on":
  55. issues:
  56. types:
  57. - opened
  58. - reopened
  59. # roles: all # Roles processed as role check in pre-activation job
  60. workflow_dispatch:
  61. inputs:
  62. aw_context:
  63. default: ""
  64. description: Agent caller context (used internally by Agentic Workflows).
  65. required: false
  66. type: string
  67. issue_number:
  68. description: 要分类的 issue 编号
  69. required: true
  70. type: string
  71. permissions: {}
  72. concurrency:
  73. group: "gh-aw-${{ github.workflow }}-${{ github.event.issue.number || github.run_id }}"
  74. run-name: "Issue Triage"
  75. jobs:
  76. activation:
  77. runs-on: ubuntu-slim
  78. permissions:
  79. actions: read
  80. contents: read
  81. outputs:
  82. body: ${{ steps.sanitized.outputs.body }}
  83. comment_id: ""
  84. comment_repo: ""
  85. lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }}
  86. model: ${{ steps.generate_aw_info.outputs.model }}
  87. secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }}
  88. setup-trace-id: ${{ steps.setup.outputs.trace-id }}
  89. stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }}
  90. text: ${{ steps.sanitized.outputs.text }}
  91. title: ${{ steps.sanitized.outputs.title }}
  92. steps:
  93. - name: Setup Scripts
  94. id: setup
  95. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  96. with:
  97. destination: ${{ runner.temp }}/gh-aw/actions
  98. job-name: ${{ github.job }}
  99. - name: Generate agentic run info
  100. id: generate_aw_info
  101. env:
  102. GH_AW_INFO_ENGINE_ID: "claude"
  103. GH_AW_INFO_ENGINE_NAME: "Claude Code"
  104. GH_AW_INFO_MODEL: "MiniMax-M2.7"
  105. GH_AW_INFO_VERSION: "2.1.98"
  106. GH_AW_INFO_AGENT_VERSION: "2.1.98"
  107. GH_AW_INFO_CLI_VERSION: "v0.68.3"
  108. GH_AW_INFO_WORKFLOW_NAME: "Issue Triage"
  109. GH_AW_INFO_EXPERIMENTAL: "false"
  110. GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true"
  111. GH_AW_INFO_STAGED: "false"
  112. GH_AW_INFO_ALLOWED_DOMAINS: '["api-inference.modelscope.cn","api.minimaxi.com","defaults","open.bigmodel.cn"]'
  113. GH_AW_INFO_FIREWALL_ENABLED: "true"
  114. GH_AW_INFO_AWF_VERSION: "v0.25.20"
  115. GH_AW_INFO_AWMG_VERSION: ""
  116. GH_AW_INFO_FIREWALL_TYPE: "squid"
  117. GH_AW_COMPILED_STRICT: "true"
  118. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  119. with:
  120. script: |
  121. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  122. setupGlobals(core, github, context, exec, io, getOctokit);
  123. const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_aw_info.cjs');
  124. await main(core, context);
  125. - name: Validate ANTHROPIC_API_KEY secret
  126. id: validate-secret
  127. run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" ANTHROPIC_API_KEY 'Claude Code' https://github.github.com/gh-aw/reference/engines/#anthropic-claude-code
  128. env:
  129. ANTHROPIC_API_KEY: ${{ secrets.MINIMAX_API_KEY }}
  130. - name: Checkout .github and .agents folders
  131. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  132. with:
  133. persist-credentials: false
  134. sparse-checkout: |
  135. .github
  136. .agents
  137. sparse-checkout-cone-mode: true
  138. fetch-depth: 1
  139. - name: Check workflow lock file
  140. id: check-lock-file
  141. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  142. env:
  143. GH_AW_WORKFLOW_FILE: "issue-triage.lock.yml"
  144. GH_AW_CONTEXT_WORKFLOW_REF: "${{ github.workflow_ref }}"
  145. with:
  146. script: |
  147. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  148. setupGlobals(core, github, context, exec, io, getOctokit);
  149. const { main } = require('${{ runner.temp }}/gh-aw/actions/check_workflow_timestamp_api.cjs');
  150. await main();
  151. - name: Check compile-agentic version
  152. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  153. env:
  154. GH_AW_COMPILED_VERSION: "v0.68.3"
  155. with:
  156. script: |
  157. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  158. setupGlobals(core, github, context, exec, io, getOctokit);
  159. const { main } = require('${{ runner.temp }}/gh-aw/actions/check_version_updates.cjs');
  160. await main();
  161. - name: Compute current body text
  162. id: sanitized
  163. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  164. with:
  165. script: |
  166. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  167. setupGlobals(core, github, context, exec, io, getOctokit);
  168. const { main } = require('${{ runner.temp }}/gh-aw/actions/compute_text.cjs');
  169. await main();
  170. - name: Create prompt with built-in context
  171. env:
  172. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  173. GH_AW_SAFE_OUTPUTS: ${{ runner.temp }}/gh-aw/safeoutputs/outputs.jsonl
  174. GH_AW_EXPR_54492A5B: ${{ github.event.issue.number || inputs.issue_number }}
  175. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  176. GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }}
  177. GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }}
  178. GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
  179. GH_AW_GITHUB_EVENT_ISSUE_TITLE: ${{ github.event.issue.title }}
  180. GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
  181. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  182. GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
  183. GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
  184. # poutine:ignore untrusted_checkout_exec
  185. run: |
  186. bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh"
  187. {
  188. cat << 'GH_AW_PROMPT_81d84cd495d462e6_EOF'
  189. <system>
  190. GH_AW_PROMPT_81d84cd495d462e6_EOF
  191. cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md"
  192. cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md"
  193. cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md"
  194. cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md"
  195. cat << 'GH_AW_PROMPT_81d84cd495d462e6_EOF'
  196. <safe-output-tools>
  197. Tools: add_comment, add_labels(max:2), call_workflow, missing_tool, missing_data, noop
  198. </safe-output-tools>
  199. <github-context>
  200. The following GitHub context information is available for this workflow:
  201. {{#if __GH_AW_GITHUB_ACTOR__ }}
  202. - **actor**: __GH_AW_GITHUB_ACTOR__
  203. {{/if}}
  204. {{#if __GH_AW_GITHUB_REPOSITORY__ }}
  205. - **repository**: __GH_AW_GITHUB_REPOSITORY__
  206. {{/if}}
  207. {{#if __GH_AW_GITHUB_WORKSPACE__ }}
  208. - **workspace**: __GH_AW_GITHUB_WORKSPACE__
  209. {{/if}}
  210. {{#if __GH_AW_GITHUB_EVENT_ISSUE_NUMBER__ }}
  211. - **issue-number**: #__GH_AW_GITHUB_EVENT_ISSUE_NUMBER__
  212. {{/if}}
  213. {{#if __GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER__ }}
  214. - **discussion-number**: #__GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER__
  215. {{/if}}
  216. {{#if __GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__ }}
  217. - **pull-request-number**: #__GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__
  218. {{/if}}
  219. {{#if __GH_AW_GITHUB_EVENT_COMMENT_ID__ }}
  220. - **comment-id**: __GH_AW_GITHUB_EVENT_COMMENT_ID__
  221. {{/if}}
  222. {{#if __GH_AW_GITHUB_RUN_ID__ }}
  223. - **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__
  224. {{/if}}
  225. </github-context>
  226. GH_AW_PROMPT_81d84cd495d462e6_EOF
  227. cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md"
  228. cat << 'GH_AW_PROMPT_81d84cd495d462e6_EOF'
  229. </system>
  230. {{#runtime-import .github/workflows/shared/engine.md}}
  231. {{#runtime-import .github/workflows/shared/network.md}}
  232. {{#runtime-import .github/workflows/issue-triage.md}}
  233. GH_AW_PROMPT_81d84cd495d462e6_EOF
  234. } > "$GH_AW_PROMPT"
  235. - name: Interpolate variables and render templates
  236. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  237. env:
  238. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  239. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  240. GH_AW_EXPR_54492A5B: ${{ github.event.issue.number || inputs.issue_number }}
  241. GH_AW_GITHUB_EVENT_ISSUE_TITLE: ${{ github.event.issue.title }}
  242. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  243. with:
  244. script: |
  245. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  246. setupGlobals(core, github, context, exec, io, getOctokit);
  247. const { main } = require('${{ runner.temp }}/gh-aw/actions/interpolate_prompt.cjs');
  248. await main();
  249. - name: Substitute placeholders
  250. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  251. env:
  252. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  253. GH_AW_EXPR_54492A5B: ${{ github.event.issue.number || inputs.issue_number }}
  254. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  255. GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }}
  256. GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }}
  257. GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
  258. GH_AW_GITHUB_EVENT_ISSUE_TITLE: ${{ github.event.issue.title }}
  259. GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
  260. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  261. GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
  262. GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
  263. with:
  264. script: |
  265. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  266. setupGlobals(core, github, context, exec, io, getOctokit);
  267. const substitutePlaceholders = require('${{ runner.temp }}/gh-aw/actions/substitute_placeholders.cjs');
  268. // Call the substitution function
  269. return await substitutePlaceholders({
  270. file: process.env.GH_AW_PROMPT,
  271. substitutions: {
  272. GH_AW_EXPR_54492A5B: process.env.GH_AW_EXPR_54492A5B,
  273. GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR,
  274. GH_AW_GITHUB_EVENT_COMMENT_ID: process.env.GH_AW_GITHUB_EVENT_COMMENT_ID,
  275. GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: process.env.GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER,
  276. GH_AW_GITHUB_EVENT_ISSUE_NUMBER: process.env.GH_AW_GITHUB_EVENT_ISSUE_NUMBER,
  277. GH_AW_GITHUB_EVENT_ISSUE_TITLE: process.env.GH_AW_GITHUB_EVENT_ISSUE_TITLE,
  278. GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: process.env.GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER,
  279. GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY,
  280. GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID,
  281. GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE
  282. }
  283. });
  284. - name: Validate prompt placeholders
  285. env:
  286. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  287. # poutine:ignore untrusted_checkout_exec
  288. run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_prompt_placeholders.sh"
  289. - name: Print prompt
  290. env:
  291. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  292. # poutine:ignore untrusted_checkout_exec
  293. run: bash "${RUNNER_TEMP}/gh-aw/actions/print_prompt_summary.sh"
  294. - name: Upload activation artifact
  295. if: success()
  296. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  297. with:
  298. name: activation
  299. path: |
  300. /tmp/gh-aw/aw_info.json
  301. /tmp/gh-aw/aw-prompts/prompt.txt
  302. /tmp/gh-aw/github_rate_limits.jsonl
  303. if-no-files-found: ignore
  304. retention-days: 1
  305. agent:
  306. needs: activation
  307. runs-on: ubuntu-latest
  308. permissions:
  309. actions: read
  310. checks: read
  311. contents: read
  312. discussions: read
  313. issues: read
  314. pull-requests: read
  315. statuses: read
  316. env:
  317. DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
  318. GH_AW_ASSETS_ALLOWED_EXTS: ""
  319. GH_AW_ASSETS_BRANCH: ""
  320. GH_AW_ASSETS_MAX_SIZE_KB: 0
  321. GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs
  322. GH_AW_WORKFLOW_ID_SANITIZED: issuetriage
  323. outputs:
  324. checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }}
  325. effective_tokens: ${{ steps.parse-mcp-gateway.outputs.effective_tokens }}
  326. has_patch: ${{ steps.collect_output.outputs.has_patch }}
  327. model: ${{ needs.activation.outputs.model }}
  328. output: ${{ steps.collect_output.outputs.output }}
  329. output_types: ${{ steps.collect_output.outputs.output_types }}
  330. setup-trace-id: ${{ steps.setup.outputs.trace-id }}
  331. steps:
  332. - name: Setup Scripts
  333. id: setup
  334. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  335. with:
  336. destination: ${{ runner.temp }}/gh-aw/actions
  337. job-name: ${{ github.job }}
  338. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  339. - name: Set runtime paths
  340. id: set-runtime-paths
  341. run: |
  342. {
  343. echo "GH_AW_SAFE_OUTPUTS=${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl"
  344. echo "GH_AW_SAFE_OUTPUTS_CONFIG_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/config.json"
  345. echo "GH_AW_SAFE_OUTPUTS_TOOLS_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/tools.json"
  346. } >> "$GITHUB_OUTPUT"
  347. - name: Checkout repository
  348. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  349. with:
  350. persist-credentials: false
  351. - name: Create gh-aw temp directory
  352. run: bash "${RUNNER_TEMP}/gh-aw/actions/create_gh_aw_tmp_dir.sh"
  353. - name: Configure gh CLI for GitHub Enterprise
  354. run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_gh_for_ghe.sh"
  355. env:
  356. GH_TOKEN: ${{ github.token }}
  357. - name: Configure Git credentials
  358. env:
  359. REPO_NAME: ${{ github.repository }}
  360. SERVER_URL: ${{ github.server_url }}
  361. GITHUB_TOKEN: ${{ github.token }}
  362. run: |
  363. git config --global user.email "github-actions[bot]@users.noreply.github.com"
  364. git config --global user.name "github-actions[bot]"
  365. git config --global am.keepcr true
  366. # Re-authenticate git with GitHub token
  367. SERVER_URL_STRIPPED="${SERVER_URL#https://}"
  368. git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
  369. echo "Git configured with standard GitHub Actions identity"
  370. - name: Checkout PR branch
  371. id: checkout-pr
  372. if: |
  373. github.event.pull_request || github.event.issue.pull_request
  374. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  375. env:
  376. GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  377. with:
  378. github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  379. script: |
  380. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  381. setupGlobals(core, github, context, exec, io, getOctokit);
  382. const { main } = require('${{ runner.temp }}/gh-aw/actions/checkout_pr_branch.cjs');
  383. await main();
  384. - name: Setup Node.js
  385. uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
  386. with:
  387. node-version: '24'
  388. package-manager-cache: false
  389. - name: Install AWF binary
  390. run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.20
  391. - name: Install Claude Code CLI
  392. run: npm install --ignore-scripts -g @anthropic-ai/claude-code@2.1.98
  393. - name: Parse integrity filter lists
  394. id: parse-guard-vars
  395. env:
  396. GH_AW_BLOCKED_USERS_VAR: ${{ vars.GH_AW_GITHUB_BLOCKED_USERS || '' }}
  397. GH_AW_TRUSTED_USERS_VAR: ${{ vars.GH_AW_GITHUB_TRUSTED_USERS || '' }}
  398. GH_AW_APPROVAL_LABELS_VAR: ${{ vars.GH_AW_GITHUB_APPROVAL_LABELS || '' }}
  399. run: bash "${RUNNER_TEMP}/gh-aw/actions/parse_guard_list.sh"
  400. - name: Download container images
  401. run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.20 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20 ghcr.io/github/gh-aw-firewall/squid:0.25.20 ghcr.io/github/gh-aw-mcpg:v0.2.19 ghcr.io/github/github-mcp-server:v0.32.0 node:lts-alpine
  402. - name: Write Safe Outputs Config
  403. run: |
  404. mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs"
  405. mkdir -p /tmp/gh-aw/safeoutputs
  406. mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs
  407. cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_2d65ea78bfc11ce7_EOF'
  408. {"add_comment":{"max":1,"target":"triggering"},"add_labels":{"allowed":["bug","enhancement","question","other"],"max":2,"target":"triggering"},"call_workflow":{"max":1,"workflow_files":{"issue-handle-bug":"./.github/workflows/issue-handle-bug.lock.yml","issue-handle-enhancement":"./.github/workflows/issue-handle-enhancement.lock.yml","issue-handle-other":"./.github/workflows/issue-handle-other.lock.yml","issue-handle-question":"./.github/workflows/issue-handle-question.lock.yml"},"workflows":["issue-handle-bug","issue-handle-enhancement","issue-handle-question","issue-handle-other"]},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}}
  409. GH_AW_SAFE_OUTPUTS_CONFIG_2d65ea78bfc11ce7_EOF
  410. - name: Write Safe Outputs Tools
  411. env:
  412. GH_AW_TOOLS_META_JSON: |
  413. {
  414. "description_suffixes": {
  415. "add_comment": " CONSTRAINTS: Maximum 1 comment(s) can be added. Target: triggering. Supports reply_to_id for discussion threading.",
  416. "add_labels": " CONSTRAINTS: Maximum 2 label(s) can be added. Only these labels are allowed: [\"bug\" \"enhancement\" \"question\" \"other\"]. Target: triggering."
  417. },
  418. "repo_params": {},
  419. "dynamic_tools": [
  420. {
  421. "_call_workflow_name": "issue-handle-bug",
  422. "description": "Call the 'issue-handle-bug' reusable workflow via workflow_call. This workflow must support workflow_call and be in .github/workflows/ directory in the same repository.",
  423. "inputSchema": {
  424. "additionalProperties": false,
  425. "properties": {
  426. "issue_number": {
  427. "description": "Input parameter 'issue_number' for workflow issue-handle-bug",
  428. "type": "string"
  429. },
  430. "payload": {
  431. "description": "Input parameter 'payload' for workflow issue-handle-bug",
  432. "type": "string"
  433. }
  434. },
  435. "required": [
  436. "issue_number"
  437. ],
  438. "type": "object"
  439. },
  440. "name": "issue_handle_bug"
  441. },
  442. {
  443. "_call_workflow_name": "issue-handle-enhancement",
  444. "description": "Call the 'issue-handle-enhancement' reusable workflow via workflow_call. This workflow must support workflow_call and be in .github/workflows/ directory in the same repository.",
  445. "inputSchema": {
  446. "additionalProperties": false,
  447. "properties": {
  448. "issue_number": {
  449. "description": "Input parameter 'issue_number' for workflow issue-handle-enhancement",
  450. "type": "string"
  451. },
  452. "payload": {
  453. "description": "Input parameter 'payload' for workflow issue-handle-enhancement",
  454. "type": "string"
  455. }
  456. },
  457. "required": [
  458. "issue_number"
  459. ],
  460. "type": "object"
  461. },
  462. "name": "issue_handle_enhancement"
  463. },
  464. {
  465. "_call_workflow_name": "issue-handle-question",
  466. "description": "Call the 'issue-handle-question' reusable workflow via workflow_call. This workflow must support workflow_call and be in .github/workflows/ directory in the same repository.",
  467. "inputSchema": {
  468. "additionalProperties": false,
  469. "properties": {
  470. "issue_number": {
  471. "description": "Input parameter 'issue_number' for workflow issue-handle-question",
  472. "type": "string"
  473. },
  474. "payload": {
  475. "description": "Input parameter 'payload' for workflow issue-handle-question",
  476. "type": "string"
  477. }
  478. },
  479. "required": [
  480. "issue_number"
  481. ],
  482. "type": "object"
  483. },
  484. "name": "issue_handle_question"
  485. },
  486. {
  487. "_call_workflow_name": "issue-handle-other",
  488. "description": "Call the 'issue-handle-other' reusable workflow via workflow_call. This workflow must support workflow_call and be in .github/workflows/ directory in the same repository.",
  489. "inputSchema": {
  490. "additionalProperties": false,
  491. "properties": {
  492. "issue_number": {
  493. "description": "Input parameter 'issue_number' for workflow issue-handle-other",
  494. "type": "string"
  495. },
  496. "payload": {
  497. "description": "Input parameter 'payload' for workflow issue-handle-other",
  498. "type": "string"
  499. }
  500. },
  501. "required": [
  502. "issue_number"
  503. ],
  504. "type": "object"
  505. },
  506. "name": "issue_handle_other"
  507. }
  508. ]
  509. }
  510. GH_AW_VALIDATION_JSON: |
  511. {
  512. "add_comment": {
  513. "defaultMax": 1,
  514. "fields": {
  515. "body": {
  516. "required": true,
  517. "type": "string",
  518. "sanitize": true,
  519. "maxLength": 65000
  520. },
  521. "item_number": {
  522. "issueOrPRNumber": true
  523. },
  524. "reply_to_id": {
  525. "type": "string",
  526. "maxLength": 256
  527. },
  528. "repo": {
  529. "type": "string",
  530. "maxLength": 256
  531. }
  532. }
  533. },
  534. "add_labels": {
  535. "defaultMax": 5,
  536. "fields": {
  537. "item_number": {
  538. "issueNumberOrTemporaryId": true
  539. },
  540. "labels": {
  541. "required": true,
  542. "type": "array",
  543. "itemType": "string",
  544. "itemSanitize": true,
  545. "itemMaxLength": 128
  546. },
  547. "repo": {
  548. "type": "string",
  549. "maxLength": 256
  550. }
  551. }
  552. },
  553. "missing_data": {
  554. "defaultMax": 20,
  555. "fields": {
  556. "alternatives": {
  557. "type": "string",
  558. "sanitize": true,
  559. "maxLength": 256
  560. },
  561. "context": {
  562. "type": "string",
  563. "sanitize": true,
  564. "maxLength": 256
  565. },
  566. "data_type": {
  567. "type": "string",
  568. "sanitize": true,
  569. "maxLength": 128
  570. },
  571. "reason": {
  572. "type": "string",
  573. "sanitize": true,
  574. "maxLength": 256
  575. }
  576. }
  577. },
  578. "missing_tool": {
  579. "defaultMax": 20,
  580. "fields": {
  581. "alternatives": {
  582. "type": "string",
  583. "sanitize": true,
  584. "maxLength": 512
  585. },
  586. "reason": {
  587. "required": true,
  588. "type": "string",
  589. "sanitize": true,
  590. "maxLength": 256
  591. },
  592. "tool": {
  593. "type": "string",
  594. "sanitize": true,
  595. "maxLength": 128
  596. }
  597. }
  598. },
  599. "noop": {
  600. "defaultMax": 1,
  601. "fields": {
  602. "message": {
  603. "required": true,
  604. "type": "string",
  605. "sanitize": true,
  606. "maxLength": 65000
  607. }
  608. }
  609. },
  610. "report_incomplete": {
  611. "defaultMax": 5,
  612. "fields": {
  613. "details": {
  614. "type": "string",
  615. "sanitize": true,
  616. "maxLength": 65000
  617. },
  618. "reason": {
  619. "required": true,
  620. "type": "string",
  621. "sanitize": true,
  622. "maxLength": 1024
  623. }
  624. }
  625. }
  626. }
  627. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  628. with:
  629. script: |
  630. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  631. setupGlobals(core, github, context, exec, io, getOctokit);
  632. const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_safe_outputs_tools.cjs');
  633. await main();
  634. - name: Generate Safe Outputs MCP Server Config
  635. id: safe-outputs-config
  636. run: |
  637. # Generate a secure random API key (360 bits of entropy, 40+ chars)
  638. # Mask immediately to prevent timing vulnerabilities
  639. API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
  640. echo "::add-mask::${API_KEY}"
  641. PORT=3001
  642. # Set outputs for next steps
  643. {
  644. echo "safe_outputs_api_key=${API_KEY}"
  645. echo "safe_outputs_port=${PORT}"
  646. } >> "$GITHUB_OUTPUT"
  647. echo "Safe Outputs MCP server will run on port ${PORT}"
  648. - name: Start Safe Outputs MCP HTTP Server
  649. id: safe-outputs-start
  650. env:
  651. DEBUG: '*'
  652. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  653. GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-config.outputs.safe_outputs_port }}
  654. GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-config.outputs.safe_outputs_api_key }}
  655. GH_AW_SAFE_OUTPUTS_TOOLS_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/tools.json
  656. GH_AW_SAFE_OUTPUTS_CONFIG_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/config.json
  657. GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs
  658. run: |
  659. # Environment variables are set above to prevent template injection
  660. export DEBUG
  661. export GH_AW_SAFE_OUTPUTS
  662. export GH_AW_SAFE_OUTPUTS_PORT
  663. export GH_AW_SAFE_OUTPUTS_API_KEY
  664. export GH_AW_SAFE_OUTPUTS_TOOLS_PATH
  665. export GH_AW_SAFE_OUTPUTS_CONFIG_PATH
  666. export GH_AW_MCP_LOG_DIR
  667. bash "${RUNNER_TEMP}/gh-aw/actions/start_safe_outputs_server.sh"
  668. - name: Start MCP Gateway
  669. id: start-mcp-gateway
  670. env:
  671. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  672. GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-start.outputs.api_key }}
  673. GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-start.outputs.port }}
  674. GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  675. run: |
  676. set -eo pipefail
  677. mkdir -p /tmp/gh-aw/mcp-config
  678. # Export gateway environment variables for MCP config and gateway script
  679. export MCP_GATEWAY_PORT="80"
  680. export MCP_GATEWAY_DOMAIN="host.docker.internal"
  681. MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
  682. echo "::add-mask::${MCP_GATEWAY_API_KEY}"
  683. export MCP_GATEWAY_API_KEY
  684. export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads"
  685. mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}"
  686. export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288"
  687. export DEBUG="*"
  688. export GH_AW_ENGINE="claude"
  689. export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.2.19'
  690. cat << GH_AW_MCP_CONFIG_80ac6dbf3fdfbe56_EOF | bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh"
  691. {
  692. "mcpServers": {
  693. "github": {
  694. "container": "ghcr.io/github/github-mcp-server:v0.32.0",
  695. "env": {
  696. "GITHUB_HOST": "$GITHUB_SERVER_URL",
  697. "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_MCP_SERVER_TOKEN",
  698. "GITHUB_READ_ONLY": "1",
  699. "GITHUB_TOOLSETS": "context,repos,issues,pull_requests"
  700. },
  701. "guard-policies": {
  702. "allow-only": {
  703. "approval-labels": ${{ steps.parse-guard-vars.outputs.approval_labels }},
  704. "blocked-users": ${{ steps.parse-guard-vars.outputs.blocked_users }},
  705. "min-integrity": "none",
  706. "repos": "all",
  707. "trusted-users": ${{ steps.parse-guard-vars.outputs.trusted_users }}
  708. }
  709. }
  710. },
  711. "safeoutputs": {
  712. "type": "http",
  713. "url": "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT",
  714. "headers": {
  715. "Authorization": "$GH_AW_SAFE_OUTPUTS_API_KEY"
  716. },
  717. "guard-policies": {
  718. "write-sink": {
  719. "accept": [
  720. "*"
  721. ]
  722. }
  723. }
  724. }
  725. },
  726. "gateway": {
  727. "port": $MCP_GATEWAY_PORT,
  728. "domain": "${MCP_GATEWAY_DOMAIN}",
  729. "apiKey": "${MCP_GATEWAY_API_KEY}",
  730. "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}"
  731. }
  732. }
  733. GH_AW_MCP_CONFIG_80ac6dbf3fdfbe56_EOF
  734. - name: Download activation artifact
  735. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  736. with:
  737. name: activation
  738. path: /tmp/gh-aw
  739. - name: Clean git credentials
  740. continue-on-error: true
  741. run: bash "${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh"
  742. - name: Execute Claude Code CLI
  743. id: agentic_execution
  744. # Allowed tools (sorted):
  745. # - Bash
  746. # - BashOutput
  747. # - Edit
  748. # - ExitPlanMode
  749. # - Glob
  750. # - Grep
  751. # - KillBash
  752. # - LS
  753. # - MultiEdit
  754. # - NotebookEdit
  755. # - NotebookRead
  756. # - Read
  757. # - Task
  758. # - TodoWrite
  759. # - Write
  760. # - mcp__github__download_workflow_run_artifact
  761. # - mcp__github__get_code_scanning_alert
  762. # - mcp__github__get_commit
  763. # - mcp__github__get_dependabot_alert
  764. # - mcp__github__get_discussion
  765. # - mcp__github__get_discussion_comments
  766. # - mcp__github__get_file_contents
  767. # - mcp__github__get_job_logs
  768. # - mcp__github__get_label
  769. # - mcp__github__get_latest_release
  770. # - mcp__github__get_me
  771. # - mcp__github__get_notification_details
  772. # - mcp__github__get_pull_request
  773. # - mcp__github__get_pull_request_comments
  774. # - mcp__github__get_pull_request_diff
  775. # - mcp__github__get_pull_request_files
  776. # - mcp__github__get_pull_request_review_comments
  777. # - mcp__github__get_pull_request_reviews
  778. # - mcp__github__get_pull_request_status
  779. # - mcp__github__get_release_by_tag
  780. # - mcp__github__get_secret_scanning_alert
  781. # - mcp__github__get_tag
  782. # - mcp__github__get_workflow_run
  783. # - mcp__github__get_workflow_run_logs
  784. # - mcp__github__get_workflow_run_usage
  785. # - mcp__github__issue_read
  786. # - mcp__github__list_branches
  787. # - mcp__github__list_code_scanning_alerts
  788. # - mcp__github__list_commits
  789. # - mcp__github__list_dependabot_alerts
  790. # - mcp__github__list_discussion_categories
  791. # - mcp__github__list_discussions
  792. # - mcp__github__list_issue_types
  793. # - mcp__github__list_issues
  794. # - mcp__github__list_label
  795. # - mcp__github__list_notifications
  796. # - mcp__github__list_pull_requests
  797. # - mcp__github__list_releases
  798. # - mcp__github__list_secret_scanning_alerts
  799. # - mcp__github__list_starred_repositories
  800. # - mcp__github__list_tags
  801. # - mcp__github__list_workflow_jobs
  802. # - mcp__github__list_workflow_run_artifacts
  803. # - mcp__github__list_workflow_runs
  804. # - mcp__github__list_workflows
  805. # - mcp__github__pull_request_read
  806. # - mcp__github__search_code
  807. # - mcp__github__search_issues
  808. # - mcp__github__search_orgs
  809. # - mcp__github__search_pull_requests
  810. # - mcp__github__search_repositories
  811. # - mcp__github__search_users
  812. timeout-minutes: 5
  813. run: |
  814. set -o pipefail
  815. touch /tmp/gh-aw/agent-step-summary.md
  816. (umask 177 && touch /tmp/gh-aw/agent-stdio.log)
  817. # shellcheck disable=SC1003
  818. sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --tty --env-all --exclude-env ANTHROPIC_API_KEY --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --allow-domains '*.githubusercontent.com,anthropic.com,api-inference.modelscope.cn,api.anthropic.com,api.github.com,api.minimaxi.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,cdn.playwright.dev,codeload.github.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,files.pythonhosted.org,ghcr.io,github-cloud.githubusercontent.com,github-cloud.s3.amazonaws.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,lfs.github.com,objects.githubusercontent.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,open.bigmodel.cn,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,playwright.download.prss.microsoft.com,ppa.launchpad.net,pypi.org,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,sentry.io,statsig.anthropic.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com' --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.20 --skip-pull --enable-api-proxy --anthropic-api-target api.minimaxi.com --anthropic-api-base-path /anthropic \
  819. -- /bin/bash -c 'export PATH="$(find /opt/hostedtoolcache -maxdepth 4 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && claude --print --no-chrome --mcp-config /tmp/gh-aw/mcp-config/mcp-servers.json --allowed-tools Bash,BashOutput,Edit,ExitPlanMode,Glob,Grep,KillBash,LS,MultiEdit,NotebookEdit,NotebookRead,Read,Task,TodoWrite,Write,mcp__github__download_workflow_run_artifact,mcp__github__get_code_scanning_alert,mcp__github__get_commit,mcp__github__get_dependabot_alert,mcp__github__get_discussion,mcp__github__get_discussion_comments,mcp__github__get_file_contents,mcp__github__get_job_logs,mcp__github__get_label,mcp__github__get_latest_release,mcp__github__get_me,mcp__github__get_notification_details,mcp__github__get_pull_request,mcp__github__get_pull_request_comments,mcp__github__get_pull_request_diff,mcp__github__get_pull_request_files,mcp__github__get_pull_request_review_comments,mcp__github__get_pull_request_reviews,mcp__github__get_pull_request_status,mcp__github__get_release_by_tag,mcp__github__get_secret_scanning_alert,mcp__github__get_tag,mcp__github__get_workflow_run,mcp__github__get_workflow_run_logs,mcp__github__get_workflow_run_usage,mcp__github__issue_read,mcp__github__list_branches,mcp__github__list_code_scanning_alerts,mcp__github__list_commits,mcp__github__list_dependabot_alerts,mcp__github__list_discussion_categories,mcp__github__list_discussions,mcp__github__list_issue_types,mcp__github__list_issues,mcp__github__list_label,mcp__github__list_notifications,mcp__github__list_pull_requests,mcp__github__list_releases,mcp__github__list_secret_scanning_alerts,mcp__github__list_starred_repositories,mcp__github__list_tags,mcp__github__list_workflow_jobs,mcp__github__list_workflow_run_artifacts,mcp__github__list_workflow_runs,mcp__github__list_workflows,mcp__github__pull_request_read,mcp__github__search_code,mcp__github__search_issues,mcp__github__search_orgs,mcp__github__search_pull_requests,mcp__github__search_repositories,mcp__github__search_users --debug-file /tmp/gh-aw/agent-stdio.log --verbose --permission-mode bypassPermissions --output-format stream-json "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log
  820. env:
  821. ANTHROPIC_API_KEY: ${{ secrets.MINIMAX_API_KEY }}
  822. ANTHROPIC_BASE_URL: https://api.minimaxi.com/anthropic
  823. ANTHROPIC_MODEL: MiniMax-M2.7
  824. BASH_DEFAULT_TIMEOUT_MS: 60000
  825. BASH_MAX_TIMEOUT_MS: 60000
  826. DISABLE_BUG_COMMAND: 1
  827. DISABLE_ERROR_REPORTING: 1
  828. DISABLE_TELEMETRY: 1
  829. GH_AW_MCP_CONFIG: /tmp/gh-aw/mcp-config/mcp-servers.json
  830. GH_AW_PHASE: agent
  831. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  832. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  833. GH_AW_VERSION: v0.68.3
  834. GITHUB_AW: true
  835. GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
  836. GITHUB_WORKSPACE: ${{ github.workspace }}
  837. GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
  838. GIT_AUTHOR_NAME: github-actions[bot]
  839. GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
  840. GIT_COMMITTER_NAME: github-actions[bot]
  841. MCP_TIMEOUT: 120000
  842. MCP_TOOL_TIMEOUT: 60000
  843. - name: Configure Git credentials
  844. env:
  845. REPO_NAME: ${{ github.repository }}
  846. SERVER_URL: ${{ github.server_url }}
  847. GITHUB_TOKEN: ${{ github.token }}
  848. run: |
  849. git config --global user.email "github-actions[bot]@users.noreply.github.com"
  850. git config --global user.name "github-actions[bot]"
  851. git config --global am.keepcr true
  852. # Re-authenticate git with GitHub token
  853. SERVER_URL_STRIPPED="${SERVER_URL#https://}"
  854. git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
  855. echo "Git configured with standard GitHub Actions identity"
  856. - name: Stop MCP Gateway
  857. if: always()
  858. continue-on-error: true
  859. env:
  860. MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }}
  861. MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }}
  862. GATEWAY_PID: ${{ steps.start-mcp-gateway.outputs.gateway-pid }}
  863. run: |
  864. bash "${RUNNER_TEMP}/gh-aw/actions/stop_mcp_gateway.sh" "$GATEWAY_PID"
  865. - name: Redact secrets in logs
  866. if: always()
  867. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  868. with:
  869. script: |
  870. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  871. setupGlobals(core, github, context, exec, io, getOctokit);
  872. const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs');
  873. await main();
  874. env:
  875. GH_AW_SECRET_NAMES: 'GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN,MINIMAX_API_KEY'
  876. SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  877. SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  878. SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  879. SECRET_MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }}
  880. - name: Append agent step summary
  881. if: always()
  882. run: bash "${RUNNER_TEMP}/gh-aw/actions/append_agent_step_summary.sh"
  883. - name: Copy Safe Outputs
  884. if: always()
  885. env:
  886. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  887. run: |
  888. mkdir -p /tmp/gh-aw
  889. cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true
  890. - name: Ingest agent output
  891. id: collect_output
  892. if: always()
  893. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  894. env:
  895. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  896. GH_AW_ALLOWED_DOMAINS: "*.githubusercontent.com,anthropic.com,api-inference.modelscope.cn,api.anthropic.com,api.github.com,api.minimaxi.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,cdn.playwright.dev,codeload.github.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,files.pythonhosted.org,ghcr.io,github-cloud.githubusercontent.com,github-cloud.s3.amazonaws.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,lfs.github.com,objects.githubusercontent.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,open.bigmodel.cn,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,playwright.download.prss.microsoft.com,ppa.launchpad.net,pypi.org,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,sentry.io,statsig.anthropic.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com"
  897. GITHUB_SERVER_URL: ${{ github.server_url }}
  898. GITHUB_API_URL: ${{ github.api_url }}
  899. with:
  900. script: |
  901. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  902. setupGlobals(core, github, context, exec, io, getOctokit);
  903. const { main } = require('${{ runner.temp }}/gh-aw/actions/collect_ndjson_output.cjs');
  904. await main();
  905. - name: Parse agent logs for step summary
  906. if: always()
  907. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  908. env:
  909. GH_AW_AGENT_OUTPUT: /tmp/gh-aw/agent-stdio.log
  910. with:
  911. script: |
  912. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  913. setupGlobals(core, github, context, exec, io, getOctokit);
  914. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_claude_log.cjs');
  915. await main();
  916. - name: Parse MCP Gateway logs for step summary
  917. if: always()
  918. id: parse-mcp-gateway
  919. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  920. with:
  921. script: |
  922. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  923. setupGlobals(core, github, context, exec, io, getOctokit);
  924. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_mcp_gateway_log.cjs');
  925. await main();
  926. - name: Print firewall logs
  927. if: always()
  928. continue-on-error: true
  929. env:
  930. AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs
  931. run: |
  932. # Fix permissions on firewall logs so they can be uploaded as artifacts
  933. # AWF runs with sudo, creating files owned by root
  934. sudo chmod -R a+r /tmp/gh-aw/sandbox/firewall/logs 2>/dev/null || true
  935. # Only run awf logs summary if awf command exists (it may not be installed if workflow failed before install step)
  936. if command -v awf &> /dev/null; then
  937. awf logs summary | tee -a "$GITHUB_STEP_SUMMARY"
  938. else
  939. echo 'AWF binary not installed, skipping firewall log summary'
  940. fi
  941. - name: Parse token usage for step summary
  942. if: always()
  943. continue-on-error: true
  944. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  945. with:
  946. script: |
  947. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  948. setupGlobals(core, github, context, exec, io, getOctokit);
  949. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_token_usage.cjs');
  950. await main();
  951. - name: Write agent output placeholder if missing
  952. if: always()
  953. run: |
  954. if [ ! -f /tmp/gh-aw/agent_output.json ]; then
  955. echo '{"items":[]}' > /tmp/gh-aw/agent_output.json
  956. fi
  957. - name: Upload agent artifacts
  958. if: always()
  959. continue-on-error: true
  960. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  961. with:
  962. name: agent
  963. path: |
  964. /tmp/gh-aw/aw-prompts/prompt.txt
  965. /tmp/gh-aw/mcp-logs/
  966. /tmp/gh-aw/proxy-logs/
  967. !/tmp/gh-aw/proxy-logs/proxy-tls/
  968. /tmp/gh-aw/agent_usage.json
  969. /tmp/gh-aw/agent-stdio.log
  970. /tmp/gh-aw/agent/
  971. /tmp/gh-aw/github_rate_limits.jsonl
  972. /tmp/gh-aw/safeoutputs.jsonl
  973. /tmp/gh-aw/agent_output.json
  974. /tmp/gh-aw/aw-*.patch
  975. /tmp/gh-aw/aw-*.bundle
  976. /tmp/gh-aw/sandbox/firewall/logs/
  977. /tmp/gh-aw/sandbox/firewall/audit/
  978. if-no-files-found: ignore
  979. call-issue-handle-bug:
  980. needs: safe_outputs
  981. if: needs.safe_outputs.outputs.call_workflow_name == 'issue-handle-bug'
  982. permissions:
  983. actions: read
  984. checks: read
  985. contents: read
  986. discussions: write
  987. issues: write
  988. pull-requests: write
  989. statuses: read
  990. uses: ./.github/workflows/issue-handle-bug.lock.yml
  991. with:
  992. issue_number: ${{ fromJSON(needs.safe_outputs.outputs.call_workflow_payload).issue_number }}
  993. payload: ${{ needs.safe_outputs.outputs.call_workflow_payload }}
  994. secrets: inherit
  995. call-issue-handle-enhancement:
  996. needs: safe_outputs
  997. if: needs.safe_outputs.outputs.call_workflow_name == 'issue-handle-enhancement'
  998. permissions:
  999. actions: read
  1000. checks: read
  1001. contents: read
  1002. discussions: write
  1003. issues: write
  1004. pull-requests: write
  1005. statuses: read
  1006. uses: ./.github/workflows/issue-handle-enhancement.lock.yml
  1007. with:
  1008. issue_number: ${{ fromJSON(needs.safe_outputs.outputs.call_workflow_payload).issue_number }}
  1009. payload: ${{ needs.safe_outputs.outputs.call_workflow_payload }}
  1010. secrets: inherit
  1011. call-issue-handle-other:
  1012. needs: safe_outputs
  1013. if: needs.safe_outputs.outputs.call_workflow_name == 'issue-handle-other'
  1014. permissions:
  1015. actions: read
  1016. checks: read
  1017. contents: read
  1018. discussions: write
  1019. issues: write
  1020. pull-requests: write
  1021. statuses: read
  1022. uses: ./.github/workflows/issue-handle-other.lock.yml
  1023. with:
  1024. issue_number: ${{ fromJSON(needs.safe_outputs.outputs.call_workflow_payload).issue_number }}
  1025. payload: ${{ needs.safe_outputs.outputs.call_workflow_payload }}
  1026. secrets: inherit
  1027. call-issue-handle-question:
  1028. needs: safe_outputs
  1029. if: needs.safe_outputs.outputs.call_workflow_name == 'issue-handle-question'
  1030. permissions:
  1031. actions: read
  1032. checks: read
  1033. contents: read
  1034. discussions: write
  1035. issues: write
  1036. pull-requests: write
  1037. statuses: read
  1038. uses: ./.github/workflows/issue-handle-question.lock.yml
  1039. with:
  1040. issue_number: ${{ fromJSON(needs.safe_outputs.outputs.call_workflow_payload).issue_number }}
  1041. payload: ${{ needs.safe_outputs.outputs.call_workflow_payload }}
  1042. secrets: inherit
  1043. conclusion:
  1044. needs:
  1045. - activation
  1046. - agent
  1047. - call-issue-handle-bug
  1048. - call-issue-handle-enhancement
  1049. - call-issue-handle-other
  1050. - call-issue-handle-question
  1051. - detection
  1052. - safe_outputs
  1053. if: >
  1054. always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true' ||
  1055. needs.activation.outputs.stale_lock_file_failed == 'true')
  1056. runs-on: ubuntu-slim
  1057. permissions:
  1058. contents: read
  1059. discussions: write
  1060. issues: write
  1061. pull-requests: write
  1062. concurrency:
  1063. group: "gh-aw-conclusion-issue-triage"
  1064. cancel-in-progress: false
  1065. outputs:
  1066. incomplete_count: ${{ steps.report_incomplete.outputs.incomplete_count }}
  1067. noop_message: ${{ steps.noop.outputs.noop_message }}
  1068. tools_reported: ${{ steps.missing_tool.outputs.tools_reported }}
  1069. total_count: ${{ steps.missing_tool.outputs.total_count }}
  1070. steps:
  1071. - name: Setup Scripts
  1072. id: setup
  1073. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  1074. with:
  1075. destination: ${{ runner.temp }}/gh-aw/actions
  1076. job-name: ${{ github.job }}
  1077. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1078. - name: Download agent output artifact
  1079. id: download-agent-output
  1080. continue-on-error: true
  1081. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1082. with:
  1083. name: agent
  1084. path: /tmp/gh-aw/
  1085. - name: Setup agent output environment variable
  1086. id: setup-agent-output-env
  1087. if: steps.download-agent-output.outcome == 'success'
  1088. run: |
  1089. mkdir -p /tmp/gh-aw/
  1090. find "/tmp/gh-aw/" -type f -print
  1091. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1092. - name: Process no-op messages
  1093. id: noop
  1094. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  1095. env:
  1096. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1097. GH_AW_NOOP_MAX: "1"
  1098. GH_AW_WORKFLOW_NAME: "Issue Triage"
  1099. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1100. GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
  1101. GH_AW_NOOP_REPORT_AS_ISSUE: "true"
  1102. with:
  1103. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1104. script: |
  1105. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1106. setupGlobals(core, github, context, exec, io, getOctokit);
  1107. const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_noop_message.cjs');
  1108. await main();
  1109. - name: Log detection run
  1110. id: detection_runs
  1111. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  1112. env:
  1113. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1114. GH_AW_WORKFLOW_NAME: "Issue Triage"
  1115. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1116. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  1117. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  1118. with:
  1119. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1120. script: |
  1121. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1122. setupGlobals(core, github, context, exec, io, getOctokit);
  1123. const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_detection_runs.cjs');
  1124. await main();
  1125. - name: Record missing tool
  1126. id: missing_tool
  1127. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  1128. env:
  1129. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1130. GH_AW_MISSING_TOOL_CREATE_ISSUE: "true"
  1131. GH_AW_WORKFLOW_NAME: "Issue Triage"
  1132. with:
  1133. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1134. script: |
  1135. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1136. setupGlobals(core, github, context, exec, io, getOctokit);
  1137. const { main } = require('${{ runner.temp }}/gh-aw/actions/missing_tool.cjs');
  1138. await main();
  1139. - name: Record incomplete
  1140. id: report_incomplete
  1141. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  1142. env:
  1143. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1144. GH_AW_REPORT_INCOMPLETE_CREATE_ISSUE: "true"
  1145. GH_AW_WORKFLOW_NAME: "Issue Triage"
  1146. with:
  1147. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1148. script: |
  1149. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1150. setupGlobals(core, github, context, exec, io, getOctokit);
  1151. const { main } = require('${{ runner.temp }}/gh-aw/actions/report_incomplete_handler.cjs');
  1152. await main();
  1153. - name: Handle agent failure
  1154. id: handle_agent_failure
  1155. if: always()
  1156. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  1157. env:
  1158. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1159. GH_AW_WORKFLOW_NAME: "Issue Triage"
  1160. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1161. GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
  1162. GH_AW_WORKFLOW_ID: "issue-triage"
  1163. GH_AW_ENGINE_ID: "claude"
  1164. GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }}
  1165. GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }}
  1166. GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }}
  1167. GH_AW_STALE_LOCK_FILE_FAILED: ${{ needs.activation.outputs.stale_lock_file_failed }}
  1168. GH_AW_GROUP_REPORTS: "false"
  1169. GH_AW_FAILURE_REPORT_AS_ISSUE: "true"
  1170. GH_AW_TIMEOUT_MINUTES: "5"
  1171. with:
  1172. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1173. script: |
  1174. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1175. setupGlobals(core, github, context, exec, io, getOctokit);
  1176. const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_agent_failure.cjs');
  1177. await main();
  1178. detection:
  1179. needs:
  1180. - activation
  1181. - agent
  1182. if: >
  1183. always() && needs.agent.result != 'skipped' && (needs.agent.outputs.output_types != '' || needs.agent.outputs.has_patch == 'true')
  1184. runs-on: ubuntu-latest
  1185. permissions:
  1186. contents: read
  1187. outputs:
  1188. detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
  1189. detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
  1190. detection_success: ${{ steps.detection_conclusion.outputs.success }}
  1191. steps:
  1192. - name: Setup Scripts
  1193. id: setup
  1194. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  1195. with:
  1196. destination: ${{ runner.temp }}/gh-aw/actions
  1197. job-name: ${{ github.job }}
  1198. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1199. - name: Download agent output artifact
  1200. id: download-agent-output
  1201. continue-on-error: true
  1202. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1203. with:
  1204. name: agent
  1205. path: /tmp/gh-aw/
  1206. - name: Setup agent output environment variable
  1207. id: setup-agent-output-env
  1208. if: steps.download-agent-output.outcome == 'success'
  1209. run: |
  1210. mkdir -p /tmp/gh-aw/
  1211. find "/tmp/gh-aw/" -type f -print
  1212. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1213. - name: Checkout repository for patch context
  1214. if: needs.agent.outputs.has_patch == 'true'
  1215. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  1216. with:
  1217. persist-credentials: false
  1218. # --- Threat Detection ---
  1219. - name: Clean stale firewall files from agent artifact
  1220. run: |
  1221. rm -rf /tmp/gh-aw/sandbox/firewall/logs
  1222. rm -rf /tmp/gh-aw/sandbox/firewall/audit
  1223. - name: Download container images
  1224. run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.20 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20 ghcr.io/github/gh-aw-firewall/squid:0.25.20
  1225. - name: Check if detection needed
  1226. id: detection_guard
  1227. if: always()
  1228. env:
  1229. OUTPUT_TYPES: ${{ needs.agent.outputs.output_types }}
  1230. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1231. run: |
  1232. if [[ -n "$OUTPUT_TYPES" || "$HAS_PATCH" == "true" ]]; then
  1233. echo "run_detection=true" >> "$GITHUB_OUTPUT"
  1234. echo "Detection will run: output_types=$OUTPUT_TYPES, has_patch=$HAS_PATCH"
  1235. else
  1236. echo "run_detection=false" >> "$GITHUB_OUTPUT"
  1237. echo "Detection skipped: no agent outputs or patches to analyze"
  1238. fi
  1239. - name: Clear MCP configuration for detection
  1240. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1241. run: |
  1242. rm -f /tmp/gh-aw/mcp-config/mcp-servers.json
  1243. rm -f /home/runner/.copilot/mcp-config.json
  1244. rm -f "$GITHUB_WORKSPACE/.gemini/settings.json"
  1245. - name: Prepare threat detection files
  1246. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1247. run: |
  1248. mkdir -p /tmp/gh-aw/threat-detection/aw-prompts
  1249. cp /tmp/gh-aw/aw-prompts/prompt.txt /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt 2>/dev/null || true
  1250. cp /tmp/gh-aw/agent_output.json /tmp/gh-aw/threat-detection/agent_output.json 2>/dev/null || true
  1251. for f in /tmp/gh-aw/aw-*.patch; do
  1252. [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true
  1253. done
  1254. for f in /tmp/gh-aw/aw-*.bundle; do
  1255. [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true
  1256. done
  1257. echo "Prepared threat detection files:"
  1258. ls -la /tmp/gh-aw/threat-detection/ 2>/dev/null || true
  1259. - name: Setup threat detection
  1260. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1261. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  1262. env:
  1263. WORKFLOW_NAME: "Issue Triage"
  1264. WORKFLOW_DESCRIPTION: "对新打开的 issue 进行分类、打标签,并路由到对应的处理工作流"
  1265. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1266. with:
  1267. script: |
  1268. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1269. setupGlobals(core, github, context, exec, io, getOctokit);
  1270. const { main } = require('${{ runner.temp }}/gh-aw/actions/setup_threat_detection.cjs');
  1271. await main();
  1272. - name: Ensure threat-detection directory and log
  1273. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1274. run: |
  1275. mkdir -p /tmp/gh-aw/threat-detection
  1276. touch /tmp/gh-aw/threat-detection/detection.log
  1277. - name: Setup Node.js
  1278. uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
  1279. with:
  1280. node-version: '24'
  1281. package-manager-cache: false
  1282. - name: Install AWF binary
  1283. run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.20
  1284. - name: Install Claude Code CLI
  1285. run: npm install --ignore-scripts -g @anthropic-ai/claude-code@2.1.98
  1286. - name: Execute Claude Code CLI
  1287. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1288. id: detection_agentic_execution
  1289. # Allowed tools (sorted):
  1290. # - Bash
  1291. # - BashOutput
  1292. # - ExitPlanMode
  1293. # - Glob
  1294. # - Grep
  1295. # - KillBash
  1296. # - LS
  1297. # - NotebookRead
  1298. # - Read
  1299. # - Task
  1300. # - TodoWrite
  1301. timeout-minutes: 20
  1302. run: |
  1303. set -o pipefail
  1304. touch /tmp/gh-aw/agent-step-summary.md
  1305. (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
  1306. # shellcheck disable=SC1003
  1307. sudo -E awf --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" --tty --env-all --exclude-env ANTHROPIC_API_KEY --allow-domains '*.githubusercontent.com,anthropic.com,api.anthropic.com,api.github.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,cdn.playwright.dev,codeload.github.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,files.pythonhosted.org,ghcr.io,github-cloud.githubusercontent.com,github-cloud.s3.amazonaws.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,lfs.github.com,objects.githubusercontent.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,playwright.download.prss.microsoft.com,ppa.launchpad.net,pypi.org,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,sentry.io,statsig.anthropic.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com' --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.20 --skip-pull --enable-api-proxy --anthropic-api-target api.minimaxi.com --anthropic-api-base-path /anthropic \
  1308. -- /bin/bash -c 'export PATH="$(find /opt/hostedtoolcache -maxdepth 4 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && claude --print --no-chrome --allowed-tools Bash,BashOutput,ExitPlanMode,Glob,Grep,KillBash,LS,NotebookRead,Read,Task,TodoWrite --debug-file /tmp/gh-aw/threat-detection/detection.log --verbose --permission-mode bypassPermissions --output-format stream-json "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log
  1309. env:
  1310. ANTHROPIC_API_KEY: ${{ secrets.MINIMAX_API_KEY }}
  1311. ANTHROPIC_BASE_URL: https://api.minimaxi.com/anthropic
  1312. ANTHROPIC_MODEL: MiniMax-M2.7
  1313. BASH_DEFAULT_TIMEOUT_MS: 60000
  1314. BASH_MAX_TIMEOUT_MS: 60000
  1315. DISABLE_BUG_COMMAND: 1
  1316. DISABLE_ERROR_REPORTING: 1
  1317. DISABLE_TELEMETRY: 1
  1318. GH_AW_PHASE: detection
  1319. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  1320. GH_AW_VERSION: v0.68.3
  1321. GITHUB_AW: true
  1322. GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
  1323. GITHUB_WORKSPACE: ${{ github.workspace }}
  1324. GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
  1325. GIT_AUTHOR_NAME: github-actions[bot]
  1326. GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
  1327. GIT_COMMITTER_NAME: github-actions[bot]
  1328. MCP_TIMEOUT: 120000
  1329. MCP_TOOL_TIMEOUT: 60000
  1330. - name: Upload threat detection log
  1331. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1332. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1333. with:
  1334. name: detection
  1335. path: /tmp/gh-aw/threat-detection/detection.log
  1336. if-no-files-found: ignore
  1337. - name: Parse and conclude threat detection
  1338. id: detection_conclusion
  1339. if: always()
  1340. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  1341. env:
  1342. RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
  1343. GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
  1344. with:
  1345. script: |
  1346. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1347. setupGlobals(core, github, context, exec, io, getOctokit);
  1348. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_threat_detection_results.cjs');
  1349. await main();
  1350. safe_outputs:
  1351. needs:
  1352. - activation
  1353. - agent
  1354. - detection
  1355. if: (!cancelled()) && needs.agent.result != 'skipped' && needs.detection.result == 'success'
  1356. runs-on: ubuntu-slim
  1357. permissions:
  1358. contents: read
  1359. discussions: write
  1360. issues: write
  1361. pull-requests: write
  1362. timeout-minutes: 15
  1363. env:
  1364. GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/issue-triage"
  1365. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  1366. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  1367. GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens }}
  1368. GH_AW_ENGINE_ID: "claude"
  1369. GH_AW_ENGINE_MODEL: "MiniMax-M2.7"
  1370. GH_AW_WORKFLOW_ID: "issue-triage"
  1371. GH_AW_WORKFLOW_NAME: "Issue Triage"
  1372. outputs:
  1373. call_workflow_name: ${{ steps.process_safe_outputs.outputs.call_workflow_name }}
  1374. call_workflow_payload: ${{ steps.process_safe_outputs.outputs.call_workflow_payload }}
  1375. code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }}
  1376. code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }}
  1377. comment_id: ${{ steps.process_safe_outputs.outputs.comment_id }}
  1378. comment_url: ${{ steps.process_safe_outputs.outputs.comment_url }}
  1379. create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }}
  1380. create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }}
  1381. process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }}
  1382. process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }}
  1383. steps:
  1384. - name: Setup Scripts
  1385. id: setup
  1386. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  1387. with:
  1388. destination: ${{ runner.temp }}/gh-aw/actions
  1389. job-name: ${{ github.job }}
  1390. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1391. - name: Download agent output artifact
  1392. id: download-agent-output
  1393. continue-on-error: true
  1394. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1395. with:
  1396. name: agent
  1397. path: /tmp/gh-aw/
  1398. - name: Setup agent output environment variable
  1399. id: setup-agent-output-env
  1400. if: steps.download-agent-output.outcome == 'success'
  1401. run: |
  1402. mkdir -p /tmp/gh-aw/
  1403. find "/tmp/gh-aw/" -type f -print
  1404. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1405. - name: Configure GH_HOST for enterprise compatibility
  1406. id: ghes-host-config
  1407. shell: bash
  1408. run: |
  1409. # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct
  1410. # GitHub instance (GHES/GHEC). On github.com this is a harmless no-op.
  1411. GH_HOST="${GITHUB_SERVER_URL#https://}"
  1412. GH_HOST="${GH_HOST#http://}"
  1413. echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV"
  1414. - name: Process Safe Outputs
  1415. id: process_safe_outputs
  1416. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  1417. env:
  1418. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1419. GH_AW_ALLOWED_DOMAINS: "*.githubusercontent.com,anthropic.com,api-inference.modelscope.cn,api.anthropic.com,api.github.com,api.minimaxi.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,cdn.playwright.dev,codeload.github.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,files.pythonhosted.org,ghcr.io,github-cloud.githubusercontent.com,github-cloud.s3.amazonaws.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,lfs.github.com,objects.githubusercontent.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,open.bigmodel.cn,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,playwright.download.prss.microsoft.com,ppa.launchpad.net,pypi.org,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,sentry.io,statsig.anthropic.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com"
  1420. GITHUB_SERVER_URL: ${{ github.server_url }}
  1421. GITHUB_API_URL: ${{ github.api_url }}
  1422. GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":1,\"target\":\"triggering\"},\"add_labels\":{\"allowed\":[\"bug\",\"enhancement\",\"question\",\"other\"],\"max\":2,\"target\":\"triggering\"},\"call_workflow\":{\"max\":1,\"workflow_files\":{\"issue-handle-bug\":\"./.github/workflows/issue-handle-bug.lock.yml\",\"issue-handle-enhancement\":\"./.github/workflows/issue-handle-enhancement.lock.yml\",\"issue-handle-other\":\"./.github/workflows/issue-handle-other.lock.yml\",\"issue-handle-question\":\"./.github/workflows/issue-handle-question.lock.yml\"},\"workflows\":[\"issue-handle-bug\",\"issue-handle-enhancement\",\"issue-handle-question\",\"issue-handle-other\"]},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"true\"},\"report_incomplete\":{}}"
  1423. with:
  1424. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1425. script: |
  1426. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1427. setupGlobals(core, github, context, exec, io, getOctokit);
  1428. const { main } = require('${{ runner.temp }}/gh-aw/actions/safe_output_handler_manager.cjs');
  1429. await main();
  1430. - name: Upload Safe Outputs Items
  1431. if: always()
  1432. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1433. with:
  1434. name: safe-outputs-items
  1435. path: |
  1436. /tmp/gh-aw/safe-output-items.jsonl
  1437. /tmp/gh-aw/temporary-id-map.json
  1438. if-no-files-found: ignore