issue-handle-bug.lock.yml 72 KB

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