issue-handle-bug.lock.yml 67 KB

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