issue-handle-question.lock.yml 120 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840
  1. # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"4cab91b969ab6fd058c4279e7072cc46f51077da9d462b41040e64293bcb9134","body_hash":"6abe720ae4f6f1448f02ac60a545c993b7c3d59de773202343c78e1f89b3848b","compiler_version":"v0.86.2","strict":true,"agent_id":"codex","agent_model":"gpt-5.6-luna","engine_versions":{"codex":"0.147.0"}}
  2. # gh-aw-manifest: {"version":1,"secrets":["CODEX_API_KEY","COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN","OPENAI_API_KEY","PIXEL_API_KEY"],"actions":[{"repo":"actions/cache/restore","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/cache/save","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"820762786026740c76f36085b0efc47a31fe5020","version":"v7.0.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"6aab9e5b5c91c615506061f09bedd81a23babe3c","version":"v0.86.2"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.44","digest":"sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.44@sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44","digest":"sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44@sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.44","digest":"sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.44@sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.9","digest":"sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.9@sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:0d9f1fb5fd6610c0ac1f5194a38e45a8a1e81f8a390d5142d8e4e6f26a4b3196","pinned_image":"ghcr.io/github/gh-aw-node@sha256:0d9f1fb5fd6610c0ac1f5194a38e45a8a1e81f8a390d5142d8e4e6f26a4b3196"},{"image":"ghcr.io/github/github-mcp-server:v1.9.0","digest":"sha256:881b53d6f75f69bdbc1b5b10fc2f1361717c19054143b3a8529fb5c32061a50e","pinned_image":"ghcr.io/github/github-mcp-server:v1.9.0@sha256:881b53d6f75f69bdbc1b5b10fc2f1361717c19054143b3a8529fb5c32061a50e"}]}
  3. # This file was automatically generated by gh-aw (v0.86.2). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
  4. #
  5. # ___ _ _
  6. # / _ \ | | (_)
  7. # | |_| | __ _ ___ _ __ | |_ _ ___
  8. # | _ |/ _` |/ _ \ '_ \| __| |/ __|
  9. # | | | | (_| | __/ | | | |_| | (__
  10. # \_| |_/\__, |\___|_| |_|\__|_|\___|
  11. # __/ |
  12. # _ _ |___/
  13. # | | | | / _| |
  14. # | | | | ___ _ __ _ __| |_| | _____ ____
  15. # | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___|
  16. # \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \
  17. # \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/
  18. #
  19. #
  20. # To update this file, edit the corresponding .md file and run:
  21. # gh aw compile
  22. # Not all edits will cause changes to this file.
  23. #
  24. # For more information: https://github.github.com/gh-aw/introduction/overview/
  25. #
  26. # 处理分类为 question 的 issue,进行问题分析、咨询和解答
  27. #
  28. # Resolved workflow manifest:
  29. # Imports:
  30. # - shared/engine.md
  31. # - shared/network.md
  32. #
  33. # Secrets used:
  34. # - CODEX_API_KEY
  35. # - COPILOT_GITHUB_TOKEN
  36. # - GH_AW_GITHUB_MCP_SERVER_TOKEN
  37. # - GH_AW_GITHUB_TOKEN
  38. # - GITHUB_TOKEN
  39. # - OPENAI_API_KEY
  40. # - PIXEL_API_KEY
  41. #
  42. # Custom actions used:
  43. # - actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
  44. # - actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
  45. # - actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  46. # - actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  47. # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  48. # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9)
  49. # - actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
  50. # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  51. # - github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
  52. #
  53. # Container images used:
  54. # - ghcr.io/github/gh-aw-firewall/agent:0.27.44@sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4
  55. # - ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44@sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7
  56. # - ghcr.io/github/gh-aw-firewall/squid:0.27.44@sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627
  57. # - ghcr.io/github/gh-aw-mcpg:v0.4.9@sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f
  58. # - ghcr.io/github/gh-aw-node@sha256:0d9f1fb5fd6610c0ac1f5194a38e45a8a1e81f8a390d5142d8e4e6f26a4b3196
  59. # - ghcr.io/github/github-mcp-server:v1.9.0@sha256:881b53d6f75f69bdbc1b5b10fc2f1361717c19054143b3a8529fb5c32061a50e
  60. name: "Issue Handle Question"
  61. on:
  62. workflow_call:
  63. inputs:
  64. aw_context:
  65. default: ""
  66. description: "Agent caller context (used internally by Agentic Workflows)."
  67. required: false
  68. type: string
  69. issue_number:
  70. required: true
  71. type: string
  72. payload:
  73. required: false
  74. type: string
  75. outputs:
  76. comment_id:
  77. description: ID of the first added comment
  78. value: ${{ jobs.safe_outputs.outputs.comment_id }}
  79. comment_url:
  80. description: URL of the first added comment
  81. value: ${{ jobs.safe_outputs.outputs.comment_url }}
  82. secrets:
  83. CODEX_API_KEY:
  84. required: false
  85. COPILOT_GITHUB_TOKEN:
  86. required: false
  87. GH_AW_GITHUB_MCP_SERVER_TOKEN:
  88. required: false
  89. GH_AW_GITHUB_TOKEN:
  90. required: false
  91. OPENAI_API_KEY:
  92. required: false
  93. PIXEL_API_KEY:
  94. required: false
  95. permissions: {}
  96. concurrency:
  97. group: "gh-aw-issue-handle-question-${{ github.run_id }}"
  98. run-name: "Issue Handle Question"
  99. jobs:
  100. activation:
  101. runs-on: ubuntu-slim
  102. permissions:
  103. actions: read
  104. contents: read
  105. env:
  106. GH_AW_MAX_DAILY_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_DAILY_AI_CREDITS || '5000' }}
  107. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  108. outputs:
  109. artifact_prefix: ${{ steps.artifact-prefix.outputs.prefix }}
  110. comment_id: ""
  111. comment_repo: ""
  112. daily_ai_credits_exceeded: ${{ steps.daily-effective-workflow-guardrail.outputs.daily_ai_credits_exceeded == 'true' }}
  113. daily_ai_credits_guardrail_status: ${{ steps.daily-effective-workflow-guardrail.outputs.daily_ai_credits_guardrail_status || '' }}
  114. daily_ai_credits_threshold: ${{ steps.daily-effective-workflow-guardrail.outputs.daily_ai_credits_threshold || '' }}
  115. daily_ai_credits_total_effective_tokens: ${{ steps.daily-effective-workflow-guardrail.outputs.daily_ai_credits_total_effective_tokens || '' }}
  116. engine_id: ${{ steps.generate_aw_info.outputs.engine_id }}
  117. lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }}
  118. model: ${{ steps.generate_aw_info.outputs.model }}
  119. oauth_token_check_failed: ${{ steps.check-oauth-tokens.outputs.oauth_token_check_failed == 'true' }}
  120. secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }}
  121. setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }}
  122. setup-span-id: ${{ steps.setup.outputs.span-id }}
  123. setup-trace-id: ${{ steps.setup.outputs.trace-id }}
  124. stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }}
  125. target_checkout_ref: ${{ steps.resolve-host-repo.outputs.target_checkout_ref }}
  126. target_ref: ${{ steps.resolve-host-repo.outputs.target_ref }}
  127. target_repo: ${{ steps.resolve-host-repo.outputs.target_repo }}
  128. target_repo_name: ${{ steps.resolve-host-repo.outputs.target_repo_name }}
  129. steps:
  130. - name: Setup Scripts
  131. id: setup
  132. uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
  133. with:
  134. destination: ${{ runner.temp }}/gh-aw/actions
  135. job-name: ${{ github.job }}
  136. safe-output-artifact-client: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
  137. env:
  138. GH_AW_SETUP_WORKFLOW_NAME: "Issue Handle Question"
  139. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-handle-question.lock.yml@${{ github.ref }}
  140. GH_AW_INFO_VERSION: "0.147.0"
  141. GH_AW_INFO_AWF_VERSION: "v0.27.44"
  142. GH_AW_INFO_ENGINE_ID: "codex"
  143. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  144. - name: Resolve host repo for activation checkout
  145. id: resolve-host-repo
  146. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  147. env:
  148. JOB_WORKFLOW_REPOSITORY: ${{ job.workflow_repository }}
  149. JOB_WORKFLOW_SHA: ${{ job.workflow_sha }}
  150. JOB_WORKFLOW_REF: ${{ job.workflow_ref }}
  151. JOB_WORKFLOW_FILE_PATH: ${{ job.workflow_file_path }}
  152. with:
  153. script: |
  154. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  155. setupGlobals(core, github, context, exec, io, getOctokit);
  156. const { main } = require('${{ runner.temp }}/gh-aw/actions/resolve_host_repo.cjs');
  157. await main();
  158. - name: Compute artifact prefix
  159. id: artifact-prefix
  160. env:
  161. INPUTS_JSON: ${{ toJSON(inputs) }}
  162. run: bash "${RUNNER_TEMP}/gh-aw/actions/compute_artifact_prefix.sh"
  163. - name: Generate agentic run info
  164. id: generate_aw_info
  165. env:
  166. GH_AW_INFO_ENGINE_ID: "codex"
  167. GH_AW_INFO_ENGINE_NAME: "Codex"
  168. GH_AW_INFO_MODEL: "gpt-5.6-luna"
  169. GH_AW_INFO_VERSION: "0.147.0"
  170. GH_AW_INFO_AGENT_VERSION: "0.147.0"
  171. GH_AW_INFO_CLI_VERSION: "v0.86.2"
  172. GH_AW_INFO_WORKFLOW_NAME: "Issue Handle Question"
  173. GH_AW_INFO_EXPERIMENTAL: "false"
  174. GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true"
  175. GH_AW_INFO_STAGED: "false"
  176. 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"]'
  177. GH_AW_INFO_FIREWALL_ENABLED: "true"
  178. GH_AW_INFO_AWF_VERSION: "v0.27.44"
  179. GH_AW_INFO_AWMG_VERSION: ""
  180. GH_AW_INFO_FIREWALL_TYPE: "squid"
  181. GH_AW_INFO_AGENT_RUNTIME: ""
  182. GH_AW_COMPILED_STRICT: "true"
  183. GH_AW_INFO_TARGET_REPO: ${{ steps.resolve-host-repo.outputs.target_repo }}
  184. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  185. with:
  186. script: |
  187. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  188. setupGlobals(core, github, context, exec, io, getOctokit);
  189. const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_aw_info.cjs');
  190. await main(core, context);
  191. - name: Restore daily AIC usage cache
  192. id: restore-daily-aic-cache
  193. if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
  194. continue-on-error: true
  195. uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
  196. with:
  197. key: agentic-workflow-usage-issuehandlequestion-${{ github.run_id }}
  198. restore-keys: agentic-workflow-usage-issuehandlequestion-
  199. path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
  200. - name: Restore daily AIC usage cache (artifact fallback)
  201. id: restore-daily-aic-cache-fallback
  202. if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
  203. continue-on-error: true
  204. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  205. env:
  206. GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }}
  207. GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }}
  208. with:
  209. github-token: ${{ secrets.GITHUB_TOKEN }}
  210. script: |
  211. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  212. setupGlobals(core, github, context, exec, io, getOctokit);
  213. const { main } = require('${{ runner.temp }}/gh-aw/actions/restore_aic_usage_cache_fallback.cjs');
  214. await main();
  215. - name: Check daily workflow token guardrail
  216. id: daily-effective-workflow-guardrail
  217. if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
  218. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  219. env:
  220. GH_AW_WORKFLOW_NAME: "Issue Handle Question"
  221. GH_AW_WORKFLOW_ID: "issue-handle-question"
  222. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  223. GH_AW_WORKFLOW_DISPATCH_AW_CONTEXT: ${{ github.event.inputs.aw_context || '' }}
  224. GH_AW_HAS_SLASH_COMMAND: "false"
  225. GH_AW_HAS_LABEL_COMMAND: "false"
  226. GH_AW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  227. GH_AW_MAX_DAILY_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_DAILY_AI_CREDITS || '5000' }}
  228. with:
  229. github-token: ${{ secrets.GITHUB_TOKEN }}
  230. script: |
  231. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  232. setupGlobals(core, github, context, exec, io, getOctokit);
  233. const { main } = require('${{ runner.temp }}/gh-aw/actions/check_daily_aic_workflow_guardrail.cjs');
  234. await main();
  235. - name: Validate CODEX_API_KEY or OPENAI_API_KEY secret
  236. id: validate-secret
  237. 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
  238. env:
  239. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  240. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  241. - name: Check for OAuth tokens
  242. id: check-oauth-tokens
  243. run: bash "${RUNNER_TEMP}/gh-aw/actions/check_oauth_tokens.sh"
  244. env:
  245. COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
  246. GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  247. GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  248. - name: Print cross-repo setup guidance
  249. if: failure() && steps.resolve-host-repo.outputs.target_repo != github.repository
  250. run: |
  251. echo "::error::COPILOT_GITHUB_TOKEN must be configured in the CALLER repository's secrets."
  252. echo "::error::For cross-repo workflow_call, secrets must be set in the repository that triggers the workflow."
  253. echo "::error::See: https://github.github.com/gh-aw/patterns/central-repo-ops/#cross-repo-setup"
  254. - name: Checkout .github and .agents folders
  255. if: steps.resolve-host-repo.outputs.target_repo == github.repository
  256. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  257. with:
  258. persist-credentials: false
  259. repository: ${{ steps.resolve-host-repo.outputs.target_repo }}
  260. ref: ${{ steps.resolve-host-repo.outputs.target_checkout_ref }}
  261. sparse-checkout: |
  262. .github
  263. .agents
  264. .claude
  265. .codex
  266. .gemini
  267. .pi
  268. sparse-checkout-cone-mode: true
  269. fetch-depth: 1
  270. - name: Save agent config folders for base branch restoration
  271. env:
  272. GH_AW_AGENT_FOLDERS: ".agents .codex .github"
  273. GH_AW_AGENT_FILES: "AGENTS.md"
  274. run: |
  275. bash "${RUNNER_TEMP}/gh-aw/actions/save_base_github_folders.sh"
  276. - name: Check workflow lock file
  277. id: check-lock-file
  278. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  279. env:
  280. GH_AW_WORKFLOW_FILE: "issue-handle-question.lock.yml"
  281. GH_AW_CONTEXT_WORKFLOW_REF: "${{ github.workflow_ref }}"
  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 { main } = require('${{ runner.temp }}/gh-aw/actions/check_workflow_timestamp_api.cjs');
  287. await main();
  288. - name: Check compile-agentic version
  289. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  290. env:
  291. GH_AW_COMPILED_VERSION: "v0.86.2"
  292. with:
  293. script: |
  294. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  295. setupGlobals(core, github, context, exec, io, getOctokit);
  296. const { main } = require('${{ runner.temp }}/gh-aw/actions/check_version_updates.cjs');
  297. await main();
  298. - name: Log runtime features
  299. if: ${{ contains(toJSON(vars), '"GH_AW_RUNTIME_FEATURES":') }}
  300. run: bash "${RUNNER_TEMP}/gh-aw/actions/log_runtime_features_summary.sh"
  301. - name: Create prompt with built-in context
  302. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  303. env:
  304. GH_AW_ACTIONS_DIR: ${{ runner.temp }}/gh-aw/actions
  305. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  306. GH_AW_SAFE_OUTPUTS: ${{ runner.temp }}/gh-aw/safeoutputs/outputs.jsonl
  307. GH_AW_PROMPT_CONFIG: "{\"items\":[{\"content_env\":\"GH_AW_PROMPT_CONTENT_0000\"},{\"file\":\"xpia.md\"},{\"file\":\"temp_folder_prompt.md\"},{\"file\":\"markdown.md\"},{\"file\":\"safe_outputs_prompt.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0001\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0002\"},{\"file\":\"mcp_cli_tools_prompt.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0003\"},{\"file\":\"github_mcp_tools_with_safeoutputs_prompt.md\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0004\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0005\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0006\"},{\"content_env\":\"GH_AW_PROMPT_CONTENT_0007\"}]}"
  308. GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  309. GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  310. GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  311. GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }}
  312. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  313. GH_AW_GITHUB_EVENT_ISSUE_TITLE: ${{ github.event.issue.title }}
  314. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  315. GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
  316. GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
  317. GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }}
  318. GH_AW_PROMPT_CONTENT_0000: "<system>\n"
  319. GH_AW_PROMPT_CONTENT_0001: "<safe-output-tools>\nTools: add_comment, update_issue, add_labels(max:3), missing_tool, missing_data, noop\n"
  320. GH_AW_PROMPT_CONTENT_0002: "</safe-output-tools>\n"
  321. GH_AW_PROMPT_CONTENT_0003: "<github-context>\nThe following GitHub context information is available for this workflow:\n{{#if github.actor}}\n- **actor**: __GH_AW_GITHUB_ACTOR__\n{{/if}}\n{{#if github.repository}}\n- **repository**: __GH_AW_GITHUB_REPOSITORY__\n{{/if}}\n{{#if github.workspace}}\n- **workspace**: __GH_AW_GITHUB_WORKSPACE__\n{{/if}}\n{{#if github.event.issue.number || (github.aw.context.item_type == 'issue' && github.aw.context.item_number)}}\n- **issue-number**: #__GH_AW_EXPR_802A9F6A__\n{{/if}}\n{{#if github.event.discussion.number || (github.aw.context.item_type == 'discussion' && github.aw.context.item_number)}}\n- **discussion-number**: #__GH_AW_EXPR_1A3A194A__\n{{/if}}\n{{#if github.event.pull_request.number || (github.aw.context.item_type == 'pull_request' && github.aw.context.item_number)}}\n- **pull-request-number**: #__GH_AW_EXPR_463A214A__\n{{/if}}\n{{#if github.event.comment.id || github.aw.context.comment_id}}\n- **comment-id**: __GH_AW_EXPR_FF1D34CE__\n{{/if}}\n{{#if github.run_id}}\n- **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__\n{{/if}}\n</github-context>\n\n"
  322. GH_AW_PROMPT_CONTENT_0004: "</system>\n"
  323. GH_AW_PROMPT_CONTENT_0005: "{{#runtime-import .github/workflows/shared/engine.md}}\n"
  324. GH_AW_PROMPT_CONTENT_0006: "{{#runtime-import .github/workflows/shared/network.md}}\n"
  325. GH_AW_PROMPT_CONTENT_0007: "{{#runtime-import .github/workflows/issue-handle-question.md}}\n"
  326. with:
  327. script: |
  328. const { setupGlobals } = require(process.env.GH_AW_ACTIONS_DIR + '/setup_globals.cjs');
  329. setupGlobals(core, github, context, exec, io, getOctokit);
  330. const { main } = require(process.env.GH_AW_ACTIONS_DIR + '/create_prompt.cjs');
  331. await main(core);
  332. - name: Interpolate variables and render templates
  333. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  334. env:
  335. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  336. GH_AW_ENGINE_ID: "codex"
  337. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  338. GH_AW_GITHUB_EVENT_ISSUE_TITLE: ${{ github.event.issue.title }}
  339. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  340. GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }}
  341. with:
  342. script: |
  343. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  344. setupGlobals(core, github, context, exec, io, getOctokit);
  345. const { main } = require('${{ runner.temp }}/gh-aw/actions/interpolate_prompt.cjs');
  346. await main();
  347. - name: Substitute placeholders
  348. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  349. env:
  350. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  351. GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  352. GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  353. GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  354. GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }}
  355. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  356. GH_AW_GITHUB_EVENT_ISSUE_TITLE: ${{ github.event.issue.title }}
  357. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  358. GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
  359. GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
  360. GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }}
  361. GH_AW_MCP_CLI_SERVERS_LIST: '- `safeoutputs` — run `safeoutputs --help` to see available tools'
  362. with:
  363. script: |
  364. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  365. setupGlobals(core, github, context, exec, io, getOctokit);
  366. const substitutePlaceholders = require('${{ runner.temp }}/gh-aw/actions/substitute_placeholders.cjs');
  367. // Call the substitution function
  368. return await substitutePlaceholders({
  369. file: process.env.GH_AW_PROMPT,
  370. substitutions: {
  371. GH_AW_EXPR_1A3A194A: process.env.GH_AW_EXPR_1A3A194A,
  372. GH_AW_EXPR_463A214A: process.env.GH_AW_EXPR_463A214A,
  373. GH_AW_EXPR_802A9F6A: process.env.GH_AW_EXPR_802A9F6A,
  374. GH_AW_EXPR_FF1D34CE: process.env.GH_AW_EXPR_FF1D34CE,
  375. GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR,
  376. GH_AW_GITHUB_EVENT_ISSUE_TITLE: process.env.GH_AW_GITHUB_EVENT_ISSUE_TITLE,
  377. GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY,
  378. GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID,
  379. GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE,
  380. GH_AW_INPUTS_ISSUE_NUMBER: process.env.GH_AW_INPUTS_ISSUE_NUMBER,
  381. GH_AW_MCP_CLI_SERVERS_LIST: process.env.GH_AW_MCP_CLI_SERVERS_LIST
  382. }
  383. });
  384. - name: Validate prompt placeholders
  385. env:
  386. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  387. run: |
  388. bash "${RUNNER_TEMP}/gh-aw/actions/validate_prompt_placeholders.sh"
  389. - name: Print prompt
  390. env:
  391. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  392. run: |
  393. bash "${RUNNER_TEMP}/gh-aw/actions/print_prompt_summary.sh"
  394. - name: Stage prompt files for artifact upload
  395. run: |
  396. mkdir -p /tmp/gh-aw/aw-prompts
  397. cp -a "${RUNNER_TEMP}/gh-aw/aw-prompts/." /tmp/gh-aw/aw-prompts/
  398. - name: Upload activation artifact
  399. if: success()
  400. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  401. with:
  402. name: ${{ steps.artifact-prefix.outputs.prefix }}activation
  403. include-hidden-files: true
  404. path: |
  405. /tmp/gh-aw/aw_info.json
  406. /tmp/gh-aw/models.json
  407. /tmp/gh-aw/aw-prompts/prompt.txt
  408. /tmp/gh-aw/aw-prompts/prompt-template.txt
  409. /tmp/gh-aw/aw-prompts/prompt-import-tree.json
  410. /tmp/gh-aw/github_rate_limits.jsonl
  411. /tmp/gh-aw/base
  412. /tmp/gh-aw/.codex/agents
  413. /tmp/gh-aw/.codex/skills
  414. if-no-files-found: ignore
  415. retention-days: 1
  416. agent:
  417. needs: activation
  418. if: needs.activation.outputs.daily_ai_credits_exceeded != 'true'
  419. runs-on: ubuntu-latest
  420. permissions:
  421. actions: read
  422. checks: read
  423. contents: read
  424. discussions: read
  425. issues: read
  426. pull-requests: read
  427. statuses: read
  428. concurrency:
  429. group: "gh-aw-codex-issue-handle-question"
  430. queue: max
  431. env:
  432. DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
  433. GH_AW_ASSETS_ALLOWED_EXTS: ""
  434. GH_AW_ASSETS_BRANCH: ""
  435. GH_AW_ASSETS_MAX_SIZE_KB: 0
  436. GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs
  437. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  438. GH_AW_WORKFLOW_ID_SANITIZED: issuehandlequestion
  439. outputs:
  440. agentic_engine_timeout: ${{ steps.detect-agent-errors.outputs.agentic_engine_timeout || 'false' }}
  441. ai_credits_rate_limit_error: ${{ steps.parse-mcp-gateway.outputs.ai_credits_rate_limit_error || 'false' }}
  442. aic: ${{ steps.parse-mcp-gateway.outputs.aic }}
  443. ambient_context: ${{ steps.parse-mcp-gateway.outputs.ambient_context }}
  444. artifact_prefix: ${{ needs.activation.outputs.artifact_prefix }}
  445. checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }}
  446. effective_tokens: ${{ steps.parse-mcp-gateway.outputs.effective_tokens }}
  447. has_patch: ${{ steps.collect_output.outputs.has_patch }}
  448. http_400_response_error: ${{ steps.detect-agent-errors.outputs.http_400_response_error || 'false' }}
  449. inference_access_error: ${{ steps.detect-agent-errors.outputs.inference_access_error || 'false' }}
  450. invocation_cap_exceeded: ${{ steps.detect-agent-errors.outputs.invocation_cap_exceeded || 'false' }}
  451. max_cache_misses_exceeded: ${{ steps.detect-agent-errors.outputs.max_cache_misses_exceeded || 'false' }}
  452. mcp_policy_error: ${{ steps.detect-agent-errors.outputs.mcp_policy_error || 'false' }}
  453. missing_model_pricing_error: ${{ steps.detect-agent-errors.outputs.missing_model_pricing_error || 'false' }}
  454. missing_model_pricing_model_name: ${{ steps.detect-agent-errors.outputs.missing_model_pricing_model_name || '' }}
  455. model: ${{ needs.activation.outputs.model }}
  456. model_not_supported_error: ${{ steps.detect-agent-errors.outputs.model_not_supported_error || 'false' }}
  457. output: ${{ steps.collect_output.outputs.output }}
  458. output_types: ${{ steps.collect_output.outputs.output_types }}
  459. setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }}
  460. setup-span-id: ${{ steps.setup.outputs.span-id }}
  461. setup-trace-id: ${{ steps.setup.outputs.trace-id }}
  462. unknown_model_ai_credits: ${{ steps.parse-mcp-gateway.outputs.unknown_model_ai_credits || 'false' }}
  463. steps:
  464. - name: Setup Scripts
  465. id: setup
  466. uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
  467. with:
  468. destination: ${{ runner.temp }}/gh-aw/actions
  469. job-name: ${{ github.job }}
  470. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  471. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  472. env:
  473. GH_AW_SETUP_WORKFLOW_NAME: "Issue Handle Question"
  474. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-handle-question.lock.yml@${{ github.ref }}
  475. GH_AW_INFO_VERSION: "0.147.0"
  476. GH_AW_INFO_AWF_VERSION: "v0.27.44"
  477. GH_AW_INFO_ENGINE_ID: "codex"
  478. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  479. - name: Set runtime paths
  480. id: set-runtime-paths
  481. run: |
  482. {
  483. echo "GH_AW_SAFE_OUTPUTS=${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl"
  484. echo "GH_AW_SAFE_OUTPUTS_CONFIG_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/config.json"
  485. echo "GH_AW_SAFE_OUTPUTS_TOOLS_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/tools.json"
  486. } >> "$GITHUB_OUTPUT"
  487. - name: Checkout repository
  488. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  489. with:
  490. persist-credentials: false
  491. - name: Create gh-aw temp directory
  492. run: bash "${RUNNER_TEMP}/gh-aw/actions/create_gh_aw_tmp_dir.sh"
  493. - name: Configure gh CLI for GitHub Enterprise
  494. run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_gh_for_ghe.sh"
  495. env:
  496. GH_TOKEN: ${{ github.token }}
  497. - name: Download activation artifact
  498. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  499. with:
  500. name: ${{ needs.activation.outputs.artifact_prefix }}activation
  501. path: /tmp/gh-aw
  502. - name: Configure Git credentials
  503. env:
  504. GITHUB_REPOSITORY: ${{ github.repository }}
  505. GITHUB_SERVER_URL: ${{ github.server_url }}
  506. GITHUB_TOKEN: ${{ github.token }}
  507. run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh"
  508. - name: Checkout PR branch
  509. id: checkout-pr
  510. if: |
  511. github.event.pull_request || github.event.issue.pull_request || github.event_name == 'workflow_dispatch' && fromJSON(github.event.inputs.aw_context || '{}').item_type == 'pull_request'
  512. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  513. env:
  514. GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  515. with:
  516. github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  517. script: |
  518. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  519. setupGlobals(core, github, context, exec, io, getOctokit);
  520. const { main } = require('${{ runner.temp }}/gh-aw/actions/checkout_pr_branch.cjs');
  521. await main();
  522. - name: Setup Node.js
  523. uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
  524. with:
  525. node-version: '24'
  526. package-manager-cache: false
  527. - name: Install Codex CLI
  528. run: npm install --ignore-scripts -g @openai/codex@0.147.0
  529. - name: Install AWF binary
  530. run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.27.44 --rootless
  531. - name: Determine automatic lockdown mode for GitHub MCP Server
  532. id: determine-automatic-lockdown
  533. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9)
  534. env:
  535. GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  536. GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  537. GH_AW_GITHUB_MIN_INTEGRITY: 'none'
  538. with:
  539. script: |
  540. const determineAutomaticLockdown = require('${{ runner.temp }}/gh-aw/actions/determine_automatic_lockdown.cjs');
  541. await determineAutomaticLockdown(github, context, core);
  542. - name: Parse integrity filter lists
  543. id: parse-guard-vars
  544. env:
  545. GH_AW_BLOCKED_USERS_VAR: ${{ vars.GH_AW_GITHUB_BLOCKED_USERS || '' }}
  546. GH_AW_TRUSTED_USERS_VAR: ${{ vars.GH_AW_GITHUB_TRUSTED_USERS || '' }}
  547. GH_AW_APPROVAL_LABELS_VAR: ${{ vars.GH_AW_GITHUB_APPROVAL_LABELS || '' }}
  548. run: bash "${RUNNER_TEMP}/gh-aw/actions/parse_guard_list.sh"
  549. - name: Restore agent config folders from base branch
  550. if: steps.checkout-pr.outcome == 'success'
  551. env:
  552. GH_AW_AGENT_FOLDERS: ".agents .codex .github"
  553. GH_AW_AGENT_FILES: "AGENTS.md"
  554. run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_base_github_folders.sh"
  555. - name: Restore inline sub-agents from activation artifact
  556. env:
  557. GH_AW_SUB_AGENT_DIR: ".codex/agents"
  558. GH_AW_SUB_AGENT_EXT: ".md"
  559. run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_sub_agents.sh"
  560. - name: Restore inline skills from activation artifact
  561. env:
  562. GH_AW_SKILL_DIR: ".codex/skills"
  563. run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_skills.sh"
  564. - name: Download container images
  565. run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.27.44@sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4 ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44@sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7 ghcr.io/github/gh-aw-firewall/squid:0.27.44@sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627 ghcr.io/github/gh-aw-mcpg:v0.4.9@sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f ghcr.io/github/gh-aw-node@sha256:0d9f1fb5fd6610c0ac1f5194a38e45a8a1e81f8a390d5142d8e4e6f26a4b3196 ghcr.io/github/github-mcp-server:v1.9.0@sha256:881b53d6f75f69bdbc1b5b10fc2f1361717c19054143b3a8529fb5c32061a50e
  566. - name: Generate Safe Outputs Config
  567. env:
  568. GH_AW_INPUT_ISSUE_NUMBER: ${{ inputs.issue_number }}
  569. run: |
  570. mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs"
  571. mkdir -p /tmp/gh-aw/safeoutputs
  572. mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs
  573. cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_d56582551139074c_EOF'
  574. {"add_comment":{"max":1,"target":"${GH_AW_INPUT_ISSUE_NUMBER}"},"add_labels":{"max":3,"target":"${GH_AW_INPUT_ISSUE_NUMBER}"},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"false"},"report_incomplete":{},"update_issue":{"allow_body":true,"max":1,"target":"${GH_AW_INPUT_ISSUE_NUMBER}"}}
  575. GH_AW_SAFE_OUTPUTS_CONFIG_d56582551139074c_EOF
  576. - name: Generate Safe Outputs Tools
  577. env:
  578. GH_AW_TOOLS_META_JSON: |
  579. {
  580. "description_suffixes": {
  581. "add_comment": " CONSTRAINTS: Maximum 1 comment(s) can be added. Target: ${{ inputs.issue_number }}. Supports reply_to_id for discussion threading.",
  582. "add_labels": " CONSTRAINTS: Maximum 3 label(s) can be added. Target: ${{ inputs.issue_number }}.",
  583. "update_issue": " CONSTRAINTS: Maximum 1 issue(s) can be updated. Target: ${{ inputs.issue_number }}."
  584. },
  585. "repo_params": {},
  586. "dynamic_tools": []
  587. }
  588. GH_AW_VALIDATION_JSON: |
  589. {
  590. "add_comment": {
  591. "defaultMax": 1,
  592. "fields": {
  593. "body": {
  594. "required": true,
  595. "type": "string",
  596. "sanitize": true,
  597. "maxLength": 65000
  598. },
  599. "comment_id": {
  600. "optionalPositiveInteger": true
  601. },
  602. "item_number": {
  603. "issueOrPRNumber": true
  604. },
  605. "pr": {
  606. "issueOrPRNumber": true
  607. },
  608. "pr_number": {
  609. "issueOrPRNumber": true
  610. },
  611. "reply_to_id": {
  612. "type": "string",
  613. "maxLength": 256
  614. },
  615. "repo": {
  616. "type": "string",
  617. "maxLength": 256
  618. },
  619. "target": {
  620. "type": "string",
  621. "enum": [
  622. "status"
  623. ]
  624. },
  625. "temporary_id": {
  626. "type": "string",
  627. "pattern": "^#?aw_[A-Za-z0-9_]{3,12}$"
  628. }
  629. }
  630. },
  631. "add_labels": {
  632. "defaultMax": 5,
  633. "fields": {
  634. "item_number": {
  635. "issueNumberOrTemporaryId": true
  636. },
  637. "labels": {
  638. "required": true,
  639. "type": "array"
  640. },
  641. "repo": {
  642. "type": "string",
  643. "maxLength": 256
  644. }
  645. }
  646. },
  647. "missing_data": {
  648. "defaultMax": 20,
  649. "fields": {
  650. "alternatives": {
  651. "type": "string",
  652. "sanitize": true,
  653. "maxLength": 256
  654. },
  655. "context": {
  656. "type": "string",
  657. "sanitize": true,
  658. "maxLength": 256
  659. },
  660. "data_type": {
  661. "type": "string",
  662. "sanitize": true,
  663. "maxLength": 128
  664. },
  665. "reason": {
  666. "type": "string",
  667. "sanitize": true,
  668. "maxLength": 256
  669. }
  670. }
  671. },
  672. "missing_tool": {
  673. "defaultMax": 20,
  674. "fields": {
  675. "alternatives": {
  676. "type": "string",
  677. "sanitize": true,
  678. "maxLength": 512
  679. },
  680. "reason": {
  681. "required": true,
  682. "type": "string",
  683. "sanitize": true,
  684. "maxLength": 256
  685. },
  686. "tool": {
  687. "type": "string",
  688. "sanitize": true,
  689. "maxLength": 128
  690. }
  691. }
  692. },
  693. "noop": {
  694. "defaultMax": 1,
  695. "fields": {
  696. "message": {
  697. "required": true,
  698. "type": "string",
  699. "sanitize": true,
  700. "maxLength": 65000
  701. }
  702. }
  703. },
  704. "report_incomplete": {
  705. "defaultMax": 5,
  706. "fields": {
  707. "details": {
  708. "type": "string",
  709. "sanitize": true,
  710. "maxLength": 65000
  711. },
  712. "reason": {
  713. "required": true,
  714. "type": "string",
  715. "sanitize": true,
  716. "maxLength": 1024
  717. }
  718. }
  719. },
  720. "update_issue": {
  721. "defaultMax": 1,
  722. "fields": {
  723. "assignees": {
  724. "type": "array",
  725. "itemType": "string",
  726. "itemSanitize": true,
  727. "itemMaxLength": 39
  728. },
  729. "body": {
  730. "type": "string",
  731. "sanitize": true,
  732. "maxLength": 65000
  733. },
  734. "issue_number": {
  735. "issueOrPRNumber": true
  736. },
  737. "labels": {
  738. "type": "array"
  739. },
  740. "milestone": {
  741. "optionalPositiveInteger": true
  742. },
  743. "operation": {
  744. "type": "string",
  745. "enum": [
  746. "replace",
  747. "append",
  748. "prepend",
  749. "replace-island"
  750. ]
  751. },
  752. "repo": {
  753. "type": "string",
  754. "maxLength": 256
  755. },
  756. "status": {
  757. "type": "string",
  758. "enum": [
  759. "open",
  760. "closed"
  761. ]
  762. },
  763. "title": {
  764. "type": "string",
  765. "sanitize": true,
  766. "maxLength": 128
  767. }
  768. },
  769. "customValidation": "requiresOneOf:status,title,body,labels,assignees,milestone"
  770. }
  771. }
  772. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  773. with:
  774. script: |
  775. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  776. setupGlobals(core, github, context, exec, io, getOctokit);
  777. const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_safe_outputs_tools.cjs');
  778. await main();
  779. - name: Start MCP Gateway
  780. id: start-mcp-gateway
  781. env:
  782. CODEX_HOME: /tmp/gh-aw/mcp-config
  783. GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST: ${{ vars.GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST || 'true' }}
  784. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  785. GH_AW_SAFE_OUTPUTS_CONFIG_PATH: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS_CONFIG_PATH }}
  786. GH_AW_SAFE_OUTPUTS_TOOLS_PATH: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS_TOOLS_PATH }}
  787. GH_AW_SINK_VISIBILITY: ${{ steps.determine-automatic-lockdown.outputs.visibility }}
  788. GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  789. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  790. GH_AW_INPUT_ISSUE_NUMBER: ${{ inputs.issue_number }}
  791. run: |
  792. set -eo pipefail
  793. mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config"
  794. # Export gateway environment variables for MCP config and gateway script
  795. export MCP_GATEWAY_PORT="8080"
  796. export MCP_GATEWAY_DOMAIN="awmg-mcpg"
  797. export MCP_GATEWAY_HOST_DOMAIN="localhost"
  798. MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
  799. echo "::add-mask::${MCP_GATEWAY_API_KEY}"
  800. export MCP_GATEWAY_API_KEY
  801. export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads"
  802. mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}"
  803. export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288"
  804. export MCP_GATEWAY_ALLOWED_MOUNT_ROOTS="${GITHUB_WORKSPACE}:rw,${RUNNER_TEMP}/gh-aw:ro,${RUNNER_TEMP}/gh-aw/safeoutputs:rw,/opt:ro,/tmp:rw,/usr/bin/gh:ro"
  805. export DEBUG="*"
  806. export GH_AW_ENGINE="codex"
  807. MCP_GATEWAY_UID=$(id -u 2>/dev/null || echo '0')
  808. MCP_GATEWAY_GID=$(id -g 2>/dev/null || echo '0')
  809. source "${RUNNER_TEMP}/gh-aw/actions/resolve_docker_socket_gid.sh"
  810. export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network bridge -p 127.0.0.1:'"${MCP_GATEWAY_PORT}"':'"${MCP_GATEWAY_PORT}"' --name awmg-mcpg --add-host host.docker.internal:host-gateway --user '"${MCP_GATEWAY_UID}"':'"${MCP_GATEWAY_GID}"' --group-add '"${DOCKER_SOCK_GID}"' -v '"${DOCKER_SOCK_PATH}"':/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 DOCKER_HOST=unix:///var/run/docker.sock -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_POLICY_ALLOW_CREATE_PULL_REQUEST -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 GH_AW_SINK_VISIBILITY -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 RUNNER_TEMP -e MCP_GATEWAY_ALLOWED_MOUNT_ROOTS -e GH_AW_INPUT_ISSUE_NUMBER -e CODEX_HOME -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 -v '"${RUNNER_TEMP}"'/gh-aw/safeoutputs:'"${RUNNER_TEMP}"'/gh-aw/safeoutputs:rw ghcr.io/github/gh-aw-mcpg:v0.4.9'
  811. cat > "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" << GH_AW_MCP_CONFIG_5be4afeb551f112b_EOF
  812. [history]
  813. persistence = "none"
  814. [shell_environment_policy]
  815. inherit = "core"
  816. 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$"]
  817. [mcp_servers.github]
  818. user_agent = "issue-handle-question"
  819. startup_timeout_sec = 120
  820. tool_timeout_sec = 60
  821. container = "ghcr.io/github/github-mcp-server:v1.9.0"
  822. env = { "GITHUB_FEATURES" = "fields_param", "GITHUB_HOST" = "$GITHUB_SERVER_URL", "GITHUB_PERSONAL_ACCESS_TOKEN" = "$GH_AW_GITHUB_TOKEN", "GITHUB_READ_ONLY" = "1", "GITHUB_TOOLSETS" = "context,repos,issues,pull_requests" }
  823. env_vars = ["GITHUB_FEATURES", "GITHUB_HOST", "GITHUB_PERSONAL_ACCESS_TOKEN", "GITHUB_READ_ONLY", "GITHUB_TOOLSETS"]
  824. [mcp_servers.safeoutputs]
  825. container = "ghcr.io/github/gh-aw-node"
  826. mounts = ["\${GITHUB_WORKSPACE}:\${GITHUB_WORKSPACE}:rw", "${RUNNER_TEMP}/gh-aw/safeoutputs:${RUNNER_TEMP}/gh-aw/safeoutputs:rw", "/tmp/gh-aw:/tmp/gh-aw:rw"]
  827. args = ["-w", "$GITHUB_WORKSPACE"]
  828. entrypoint = "sh"
  829. entrypointArgs = ["-c", "sh ${RUNNER_TEMP}/gh-aw/safeoutputs/start_safe_outputs_mcp.sh"]
  830. env_vars = ["DEBUG", "DEFAULT_BRANCH", "GH_AW_ASSETS_ALLOWED_EXTS", "GH_AW_ASSETS_BRANCH", "GH_AW_ASSETS_MAX_SIZE_KB", "GH_AW_MCP_LOG_DIR", "GH_AW_SAFE_OUTPUTS", "GH_AW_SAFE_OUTPUTS_CONFIG_PATH", "GH_AW_SAFE_OUTPUTS_TOOLS_PATH", "GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST", "GITHUB_REPOSITORY", "GITHUB_SHA", "GITHUB_TOKEN", "GITHUB_WORKSPACE", "RUNNER_TEMP", "GH_AW_INPUT_ISSUE_NUMBER"]
  831. [mcp_servers.safeoutputs."guard-policies"]
  832. [mcp_servers.safeoutputs."guard-policies".write-sink]
  833. accept = ["*"]
  834. sink-visibility = "${GH_AW_SINK_VISIBILITY}"
  835. GH_AW_MCP_CONFIG_5be4afeb551f112b_EOF
  836. # Generate JSON config for MCP gateway
  837. GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node)
  838. cat << GH_AW_MCP_CONFIG_e47e0a344d7fc713_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs"
  839. {
  840. "mcpServers": {
  841. "github": {
  842. "container": "ghcr.io/github/github-mcp-server:v1.9.0",
  843. "env": {
  844. "GITHUB_FEATURES": "fields_param",
  845. "GITHUB_HOST": "$GITHUB_SERVER_URL",
  846. "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_MCP_SERVER_TOKEN",
  847. "GITHUB_READ_ONLY": "1",
  848. "GITHUB_TOOLSETS": "context,repos,issues,pull_requests"
  849. },
  850. "guard-policies": {
  851. "allow-only": {
  852. "approval-labels": ${{ steps.parse-guard-vars.outputs.approval_labels }},
  853. "blocked-users": ${{ steps.parse-guard-vars.outputs.blocked_users }},
  854. "min-integrity": "none",
  855. "repos": "all",
  856. "trusted-users": ${{ steps.parse-guard-vars.outputs.trusted_users }}
  857. }
  858. }
  859. },
  860. "safeoutputs": {
  861. "container": "ghcr.io/github/gh-aw-node",
  862. "mounts": ["\${GITHUB_WORKSPACE}:\${GITHUB_WORKSPACE}:rw", "${RUNNER_TEMP}/gh-aw/safeoutputs:${RUNNER_TEMP}/gh-aw/safeoutputs:rw", "/tmp/gh-aw:/tmp/gh-aw:rw"],
  863. "args": ["-w", "\${GITHUB_WORKSPACE}"],
  864. "entrypoint": "sh",
  865. "entrypointArgs": ["-c", "sh ${RUNNER_TEMP}/gh-aw/safeoutputs/start_safe_outputs_mcp.sh"],
  866. "env": {
  867. "DEBUG": "*",
  868. "DEFAULT_BRANCH": "\${DEFAULT_BRANCH}",
  869. "GH_AW_ASSETS_ALLOWED_EXTS": "\${GH_AW_ASSETS_ALLOWED_EXTS}",
  870. "GH_AW_ASSETS_BRANCH": "\${GH_AW_ASSETS_BRANCH}",
  871. "GH_AW_ASSETS_MAX_SIZE_KB": "\${GH_AW_ASSETS_MAX_SIZE_KB}",
  872. "GH_AW_MCP_LOG_DIR": "\${GH_AW_MCP_LOG_DIR}",
  873. "GH_AW_SAFE_OUTPUTS": "\${GH_AW_SAFE_OUTPUTS}",
  874. "GH_AW_SAFE_OUTPUTS_CONFIG_PATH": "\${GH_AW_SAFE_OUTPUTS_CONFIG_PATH}",
  875. "GH_AW_SAFE_OUTPUTS_TOOLS_PATH": "\${GH_AW_SAFE_OUTPUTS_TOOLS_PATH}",
  876. "GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST": "\${GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST}",
  877. "GITHUB_REPOSITORY": "\${GITHUB_REPOSITORY}",
  878. "GITHUB_SHA": "\${GITHUB_SHA}",
  879. "GITHUB_TOKEN": "\${GITHUB_TOKEN}",
  880. "GITHUB_WORKSPACE": "\${GITHUB_WORKSPACE}",
  881. "RUNNER_TEMP": "\${RUNNER_TEMP}",
  882. "GH_AW_INPUT_ISSUE_NUMBER": "\${GH_AW_INPUT_ISSUE_NUMBER}"
  883. },
  884. "guard-policies": {
  885. "write-sink": {
  886. "accept": [
  887. "*"
  888. ],
  889. "sink-visibility": "${GH_AW_SINK_VISIBILITY}"
  890. }
  891. }
  892. }
  893. },
  894. "gateway": {
  895. "port": $MCP_GATEWAY_PORT,
  896. "domain": "${MCP_GATEWAY_DOMAIN}",
  897. "apiKey": "${MCP_GATEWAY_API_KEY}",
  898. "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}",
  899. "startupTimeout": 120
  900. }
  901. }
  902. GH_AW_MCP_CONFIG_e47e0a344d7fc713_EOF
  903. # Sync converter output to writable CODEX_HOME for Codex
  904. mkdir -p /tmp/gh-aw/mcp-config
  905. cat > "/tmp/gh-aw/mcp-config/config.toml" << GH_AW_CODEX_SHELL_POLICY_47d4538748fe3213_EOF
  906. model_provider = "openai-proxy"
  907. [model_providers.openai-proxy]
  908. name = "OpenAI AWF proxy"
  909. base_url = "http://172.30.0.30:10000"
  910. env_key = "OPENAI_API_KEY"
  911. supports_websockets = false
  912. [shell_environment_policy]
  913. inherit = "core"
  914. 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$"]
  915. GH_AW_CODEX_SHELL_POLICY_47d4538748fe3213_EOF
  916. awk '
  917. BEGIN { skip_openai_proxy = 0 }
  918. /^[[:space:]]*model_provider[[:space:]]*=/ { next }
  919. /^\[model_providers\.openai-proxy\][[:space:]]*$/ { skip_openai_proxy = 1; next }
  920. /^\[/ { skip_openai_proxy = 0 }
  921. !skip_openai_proxy { print }
  922. ' "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" >> "/tmp/gh-aw/mcp-config/config.toml"
  923. chmod 600 "/tmp/gh-aw/mcp-config/config.toml"
  924. mkdir -p "${CODEX_HOME}"
  925. if [ "/tmp/gh-aw/mcp-config/config.toml" != "${CODEX_HOME}/config.toml" ]; then cp "/tmp/gh-aw/mcp-config/config.toml" "${CODEX_HOME}/config.toml"; fi
  926. chmod 600 "${CODEX_HOME}/config.toml"
  927. - name: Mount MCP servers as CLIs
  928. id: mount-mcp-clis
  929. continue-on-error: true
  930. env:
  931. MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }}
  932. MCP_GATEWAY_DOMAIN: ${{ steps.start-mcp-gateway.outputs.gateway-domain }}
  933. MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }}
  934. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  935. with:
  936. script: |
  937. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  938. setupGlobals(core, github, context, exec, io);
  939. const { main } = require('${{ runner.temp }}/gh-aw/actions/mount_mcp_as_cli.cjs');
  940. await main();
  941. - name: Clean credentials
  942. continue-on-error: true
  943. run: bash "${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh"
  944. - name: Audit pre-agent workspace
  945. id: pre_agent_audit
  946. continue-on-error: true
  947. run: bash "${RUNNER_TEMP}/gh-aw/actions/audit_pre_agent_workspace.sh"
  948. - name: Execute Codex CLI
  949. id: agentic_execution
  950. timeout-minutes: 15
  951. run: |
  952. set -o pipefail
  953. printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt
  954. mkdir -p "$CODEX_HOME/logs" && touch /tmp/gh-aw/agent-step-summary.md
  955. (umask 177 && touch /tmp/gh-aw/agent-stdio.log)
  956. GH_AW_MAX_AI_CREDITS="${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }}"
  957. printf '%s\n' "{\"\$schema\":\"https://github.com/github/gh-aw-firewall/releases/download/v0.27.44/awf-config.schema.json\",\"network\":{\"allowDomains\":[\"172.30.0.1\",\"ai-pixel.online\",\"api-inference.modelscope.cn\",\"api.commandcode.ai\",\"api.deepseek.com\",\"api.github.com\",\"api.minimaxi.com\",\"api.openai.com\",\"api.snapcraft.io\",\"archive.ubuntu.com\",\"azure.archive.ubuntu.com\",\"chatgpt.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\",\"github.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\"],\"isolation\":true,\"topologyAttach\":[\"awmg-mcpg\"]},\"apiProxy\":{\"enabled\":true,\"enableTokenSteering\":true,\"maxRuns\":500,\"maxAiCredits\":${GH_AW_MAX_AI_CREDITS},\"maxCacheMisses\":5,\"targets\":{\"openai\":{\"host\":\"api.ai-pixel.online\"}},\"models\":{\"agent\":[\"sonnet-6x\",\"gpt-5.4\",\"gpt-5.5\",\"gpt-5.6\",\"gpt-5.3\",\"gemini-pro\",\"any\"],\"antigravity\":[\"copilot/antigravity*\",\"google/antigravity*\",\"gemini/antigravity*\"],\"any\":[\"copilot/*\",\"anthropic/*\",\"openai/*\",\"google/*\",\"gemini/*\"],\"auto\":[\"copilot/auto\",\"large\"],\"claude\":[\"agent\"],\"codex\":[\"agent\"],\"coding\":[\"copilot/gpt-5*codex*\",\"openai/gpt-5*codex*\",\"gpt-5-codex\",\"kimi\"],\"computer-use\":[\"copilot/*computer-use*\",\"google/*computer-use*\",\"gemini/*computer-use*\",\"openai/*computer-use*\"],\"copilot\":[\"agent\"],\"deep-research\":[\"copilot/deep-research*\",\"copilot/o3-deep-research*\",\"copilot/o4-mini-deep-research*\",\"google/deep-research*\",\"gemini/deep-research*\",\"openai/o3-deep-research*\",\"openai/o4-mini-deep-research*\"],\"detection\":[\"small\"],\"evals\":[\"small\"],\"fable\":[\"copilot/*fable*\",\"anthropic/*fable*\"],\"gemini\":[\"agent\"],\"gemini-3-flash\":[\"copilot/gemini-3*flash*\",\"google/gemini-3*flash*\",\"gemini/gemini-3*flash*\"],\"gemini-3-pro\":[\"copilot/gemini-3*pro*\",\"google/gemini-3*pro*\",\"google/nano-banana*\",\"gemini/gemini-3*pro*\"],\"gemini-3.1-flash\":[\"copilot/gemini-3.1*flash*\",\"google/gemini-3.1*flash*\",\"gemini/gemini-3.1*flash*\"],\"gemini-3.1-pro\":[\"copilot/gemini-3.1*pro*\",\"google/gemini-3.1*pro*\",\"gemini/gemini-3.1*pro*\"],\"gemini-3.5-flash\":[\"copilot/gemini-3.5*flash*\",\"google/gemini-3.5*flash*\",\"gemini/gemini-3.5*flash*\"],\"gemini-3.6-flash\":[\"copilot/gemini-3.6*flash*\",\"google/gemini-3.6*flash*\",\"gemini/gemini-3.6*flash*\"],\"gemini-flash\":[\"copilot/gemini-*flash*\",\"google/gemini-*flash*\",\"gemini/gemini-*flash*\"],\"gemini-flash-lite\":[\"copilot/gemini-*flash*lite*\",\"google/gemini-*flash*lite*\",\"gemini/gemini-*flash*lite*\"],\"gemini-omni\":[\"copilot/gemini-omni*\",\"google/gemini-omni*\",\"gemini/gemini-omni*\"],\"gemini-pro\":[\"copilot/gemini-*pro*\",\"google/gemini-*pro*\",\"gemini/gemini-*pro*\"],\"gemma\":[\"copilot/gemma*\",\"google/gemma*\",\"gemini/gemma*\"],\"gpt-5\":[\"copilot/gpt-5*\",\"openai/gpt-5*\"],\"gpt-5-codex\":[\"copilot/gpt-5*codex*\",\"openai/gpt-5*codex*\"],\"gpt-5-mini\":[\"copilot/gpt-5*mini*\",\"openai/gpt-5*mini*\"],\"gpt-5-nano\":[\"copilot/gpt-5*nano*\",\"openai/gpt-5*nano*\"],\"gpt-5-pro\":[\"copilot/gpt-5*pro*\",\"openai/gpt-5*pro*\"],\"gpt-5.1\":[\"copilot/gpt-5.1*\",\"openai/gpt-5.1*\"],\"gpt-5.2\":[\"copilot/gpt-5.2*\",\"openai/gpt-5.2*\"],\"gpt-5.3\":[\"copilot/gpt-5.3*\",\"openai/gpt-5.3*\"],\"gpt-5.4\":[\"copilot/gpt-5.4*\",\"openai/gpt-5.4*\"],\"gpt-5.5\":[\"copilot/gpt-5.5*\",\"openai/gpt-5.5*\"],\"gpt-5.6\":[\"copilot/gpt-5.6*\",\"openai/gpt-5.6*\"],\"grok\":[\"copilot/*grok*\",\"openai/*grok*\"],\"haiku\":[\"copilot/*haiku*\",\"anthropic/*haiku*\"],\"image-generation\":[\"copilot/gpt-image*\",\"openai/gpt-image*\",\"openai/chatgpt-image*\",\"copilot/gemini-*image*\",\"google/gemini-*image*\",\"gemini/gemini-*image*\",\"google/imagen*\"],\"kimi\":[\"copilot/kimi*\",\"openai/kimi*\"],\"kiwi\":[\"copilot/kiwi*\",\"openai/kiwi*\"],\"large\":[\"sonnet\",\"gpt-5-pro\",\"gpt-5\",\"gemini-pro\"],\"lyria\":[\"google/lyria*\",\"gemini/lyria*\",\"copilot/lyria*\"],\"mai-code\":[\"copilot/MAI-Code*\",\"copilot/mai-code*\",\"openai/MAI-Code*\"],\"mai-code-1-flash-picker\":[\"copilot/MAI-Code-1-Flash-picker*\",\"copilot/mai-code-1-flash-picker*\",\"openai/MAI-Code-1-Flash-picker*\"],\"mini\":[\"haiku\",\"gpt-5-mini\",\"gpt-5-nano\",\"gemini-flash-lite\"],\"nano-banana\":[\"copilot/nano-banana*\",\"google/nano-banana*\",\"gemini/nano-banana*\"],\"opus\":[\"copilot/*opus*\",\"anthropic/*opus*\"],\"opusplan\":[\"opus?effort=high\"],\"raptor-mini\":[\"copilot/raptor*\",\"openai/raptor*\"],\"reasoning\":[\"copilot/o1*\",\"copilot/o3*\",\"copilot/o4*\",\"openai/o1*\",\"openai/o3*\",\"openai/o4*\"],\"robotics\":[\"copilot/*robotics*\",\"google/*robotics*\",\"gemini/*robotics*\"],\"small\":[\"mini\"],\"small-agent\":[\"haiku\",\"gpt-5-mini\",\"gemini-flash\"],\"sonnet\":[\"copilot/*sonnet*\",\"anthropic/*sonnet*\"],\"sonnet-6x\":[\"copilot/*sonnet-4.5*\",\"copilot/*sonnet-4.6*\",\"copilot/*sonnet-5*\",\"copilot/*sonnet-4-5-*\",\"anthropic/*sonnet-4-5-*\",\"copilot/*sonnet-4-6*\",\"anthropic/*sonnet-4-6*\",\"anthropic/*sonnet-5*\"],\"summarization\":[\"haiku\",\"gpt-5-mini\",\"gemini-flash-lite\",\"mini\"],\"veo\":[\"google/veo*\",\"gemini/veo*\"],\"vision\":[\"copilot/gemini-*image*\",\"google/gemini-*image*\",\"gemini/gemini-*image*\",\"copilot/gemini-*flash*\",\"google/gemini-*flash*\",\"gemini/gemini-*flash*\"]}},\"container\":{\"imageTag\":\"0.27.44,squid=sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627,agent=sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4,api-proxy=sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7,cli-proxy=sha256:c064d15974f7c933ec7d3f7b4038f4fd203547b3154bdc821afd379144887eff\"},\"logging\":{\"proxyLogsDir\":\"/tmp/gh-aw/sandbox/firewall/logs\",\"auditDir\":\"/tmp/gh-aw/sandbox/firewall/audit\"}}" > "${RUNNER_TEMP}/gh-aw/awf-config.json"
  958. cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json
  959. export GH_AW_MODELS_JSON_PATH="/tmp/gh-aw/models.json"
  960. GH_AW_DOCKER_HOST=""
  961. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  962. GH_AW_DOCKER_HOST="${DOCKER_HOST}"
  963. fi
  964. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  965. GH_AW_CHROOT_BINARIES_SOURCE_PATH="${RUNNER_TEMP}/gh-aw" GH_AW_CHROOT_IDENTITY_HOME="${RUNNER_TEMP}/gh-aw/home" node "${RUNNER_TEMP}/gh-aw/actions/patch_awf_chroot_config.cjs"
  966. fi
  967. GH_AW_TOOL_CACHE_MOUNT=""
  968. GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"
  969. if [ -d "$GH_AW_TOOL_CACHE" ]; then
  970. if [[ "$GH_AW_TOOL_CACHE" != /opt/* ]]; then
  971. GH_AW_TOOL_CACHE_MOUNT="$GH_AW_TOOL_CACHE:$GH_AW_TOOL_CACHE:ro"
  972. fi
  973. fi
  974. # shellcheck disable=SC1003,SC2016,SC2086
  975. awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --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" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env CODEX_API_KEY --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --exclude-env OPENAI_API_KEY --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --skip-pull \
  976. -- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; export PATH="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/codex_harness.cjs codex exec${GH_AW_MODEL_AGENT_CODEX:+ --model "$GH_AW_MODEL_AGENT_CODEX"} -c web_search="disabled" -c fetch="disabled" --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log
  977. env:
  978. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }}
  979. CODEX_HOME: /tmp/gh-aw/mcp-config
  980. GH_AW_INPUT_ISSUE_NUMBER: ${{ inputs.issue_number }}
  981. GH_AW_MAX_TURNS: ${{ vars.GH_AW_DEFAULT_MAX_TURNS || '' }}
  982. GH_AW_MCP_CONFIG: ${{ runner.temp }}/gh-aw/mcp-config/config.toml
  983. GH_AW_MODEL_AGENT_CODEX: gpt-5.6-luna
  984. GH_AW_PHASE: agent
  985. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  986. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  987. GH_AW_VERSION: v0.86.2
  988. GITHUB_AW: true
  989. GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
  990. GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
  991. GIT_AUTHOR_NAME: github-actions[bot]
  992. GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
  993. GIT_COMMITTER_NAME: github-actions[bot]
  994. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  995. OPENAI_BASE_URL: https://api.ai-pixel.online
  996. RUNNER_TEMP: ${{ runner.temp }}
  997. RUST_LOG: ${{ runner.debug == 1 && 'trace,hyper_util=info,mio=info,reqwest=info,os_info=info,codex_otel=warn,codex_core=debug,ocodex_exec=debug' || 'warn' }}
  998. TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }}
  999. - name: Detect agent errors
  1000. if: always()
  1001. id: detect-agent-errors
  1002. continue-on-error: true
  1003. run: node "${RUNNER_TEMP}/gh-aw/actions/detect_agent_errors.cjs"
  1004. - name: Configure Git credentials
  1005. env:
  1006. GITHUB_REPOSITORY: ${{ github.repository }}
  1007. GITHUB_SERVER_URL: ${{ github.server_url }}
  1008. GITHUB_TOKEN: ${{ github.token }}
  1009. run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh"
  1010. - name: Stop MCP Gateway
  1011. if: always()
  1012. continue-on-error: true
  1013. env:
  1014. MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }}
  1015. MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }}
  1016. GATEWAY_PID: ${{ steps.start-mcp-gateway.outputs.gateway-pid }}
  1017. run: |
  1018. bash "${RUNNER_TEMP}/gh-aw/actions/stop_mcp_gateway.sh" "$GATEWAY_PID"
  1019. - name: Redact secrets in logs
  1020. if: always()
  1021. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1022. with:
  1023. script: |
  1024. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1025. setupGlobals(core, github, context, exec, io, getOctokit);
  1026. const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs');
  1027. await main();
  1028. env:
  1029. 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'
  1030. SECRET_CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  1031. SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  1032. SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  1033. SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  1034. SECRET_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  1035. SECRET_PIXEL_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1036. - name: Append agent step summary
  1037. if: always()
  1038. run: bash "${RUNNER_TEMP}/gh-aw/actions/append_agent_step_summary.sh"
  1039. - name: Copy Safe Outputs
  1040. if: always()
  1041. env:
  1042. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  1043. run: |
  1044. mkdir -p /tmp/gh-aw
  1045. cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true
  1046. - name: Ingest agent output
  1047. id: collect_output
  1048. if: always()
  1049. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1050. env:
  1051. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  1052. GH_AW_ALLOWED_DOMAINS: "172.30.0.1,ai-pixel.online,api-inference.modelscope.cn,api.commandcode.ai,api.deepseek.com,api.github.com,api.minimaxi.com,api.openai.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,chatgpt.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,github.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"
  1053. GITHUB_SERVER_URL: ${{ github.server_url }}
  1054. GITHUB_API_URL: ${{ github.api_url }}
  1055. with:
  1056. script: |
  1057. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1058. setupGlobals(core, github, context, exec, io, getOctokit);
  1059. const { main } = require('${{ runner.temp }}/gh-aw/actions/collect_ndjson_output.cjs');
  1060. await main();
  1061. - name: Parse agent logs for step summary
  1062. if: always()
  1063. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1064. env:
  1065. GH_AW_AGENT_OUTPUT: /tmp/gh-aw/agent-stdio.log
  1066. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  1067. with:
  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/parse_codex_log.cjs');
  1072. await main();
  1073. - name: Parse MCP Gateway logs for step summary
  1074. if: always()
  1075. id: parse-mcp-gateway
  1076. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1077. with:
  1078. script: |
  1079. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1080. setupGlobals(core, github, context, exec, io, getOctokit);
  1081. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_mcp_gateway_log.cjs');
  1082. await main();
  1083. - name: Print firewall logs
  1084. if: always()
  1085. continue-on-error: true
  1086. env:
  1087. AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs
  1088. run: bash "${RUNNER_TEMP}/gh-aw/actions/print_firewall_logs.sh" --rootless
  1089. - name: Parse token usage for step summary
  1090. if: always()
  1091. continue-on-error: true
  1092. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1093. with:
  1094. script: |
  1095. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1096. setupGlobals(core, github, context, exec, io, getOctokit);
  1097. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_token_usage.cjs');
  1098. await main();
  1099. - name: Print AWF reflect summary
  1100. if: always()
  1101. continue-on-error: true
  1102. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1103. with:
  1104. script: |
  1105. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1106. setupGlobals(core, github, context, exec, io, getOctokit);
  1107. const { main } = require('${{ runner.temp }}/gh-aw/actions/awf_reflect_summary.cjs');
  1108. await main();
  1109. - name: Write agent output placeholder if missing
  1110. if: always()
  1111. run: |
  1112. if [ ! -f /tmp/gh-aw/agent_output.json ]; then
  1113. echo '{"items":[]}' > /tmp/gh-aw/agent_output.json
  1114. fi
  1115. - name: Upload agent artifacts
  1116. if: always()
  1117. continue-on-error: true
  1118. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1119. with:
  1120. name: ${{ needs.activation.outputs.artifact_prefix }}agent
  1121. path: |
  1122. /tmp/gh-aw/aw-prompts/prompt.txt
  1123. /tmp/gh-aw/mcp-config/logs/
  1124. /tmp/gh-aw/redacted-urls.log
  1125. /tmp/gh-aw/mcp-logs/
  1126. /tmp/gh-aw/proxy-logs/
  1127. !/tmp/gh-aw/proxy-logs/proxy-tls/
  1128. /tmp/gh-aw/agent_usage.json
  1129. /tmp/gh-aw/agent-stdio.log
  1130. /tmp/gh-aw/pre-agent-audit.txt
  1131. /tmp/gh-aw/agent/
  1132. /tmp/gh-aw/github_rate_limits.jsonl
  1133. /tmp/gh-aw/safeoutputs.jsonl
  1134. /tmp/gh-aw/agent_output.json
  1135. /tmp/gh-aw/aw-*.patch
  1136. /tmp/gh-aw/aw-*.bundle
  1137. /tmp/gh-aw/awf-config.json
  1138. /tmp/gh-aw/sandbox/firewall/logs/
  1139. /tmp/gh-aw/sandbox/firewall/audit/
  1140. /tmp/gh-aw/sandbox/firewall/awf-reflect.json
  1141. if-no-files-found: ignore
  1142. conclusion:
  1143. needs:
  1144. - activation
  1145. - agent
  1146. - detection
  1147. - safe_outputs
  1148. if: >
  1149. always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true' ||
  1150. needs.activation.outputs.oauth_token_check_failed == 'true' || needs.activation.outputs.stale_lock_file_failed == 'true' ||
  1151. needs.activation.outputs.secret_verification_result == 'failed' || needs.activation.outputs.daily_ai_credits_exceeded == 'true')
  1152. runs-on: ubuntu-slim
  1153. permissions:
  1154. actions: read
  1155. issues: write
  1156. pull-requests: write
  1157. concurrency:
  1158. group: "gh-aw-conclusion-issue-handle-question"
  1159. cancel-in-progress: false
  1160. queue: max
  1161. env:
  1162. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  1163. outputs:
  1164. incomplete_count: ${{ steps.report_incomplete.outputs.incomplete_count }}
  1165. noop_message: ${{ steps.noop.outputs.noop_message }}
  1166. tools_reported: ${{ steps.missing_tool.outputs.tools_reported }}
  1167. total_count: ${{ steps.missing_tool.outputs.total_count }}
  1168. steps:
  1169. - name: Setup Scripts
  1170. id: setup
  1171. uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
  1172. with:
  1173. destination: ${{ runner.temp }}/gh-aw/actions
  1174. job-name: ${{ github.job }}
  1175. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1176. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  1177. env:
  1178. GH_AW_SETUP_WORKFLOW_NAME: "Issue Handle Question"
  1179. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-handle-question.lock.yml@${{ github.ref }}
  1180. GH_AW_INFO_VERSION: "0.147.0"
  1181. GH_AW_INFO_AWF_VERSION: "v0.27.44"
  1182. GH_AW_INFO_ENGINE_ID: "codex"
  1183. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  1184. - name: Download agent output artifact
  1185. id: download-agent-output
  1186. continue-on-error: true
  1187. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1188. with:
  1189. name: ${{ needs.activation.outputs.artifact_prefix }}agent
  1190. path: /tmp/gh-aw/
  1191. - name: Setup agent output environment variable
  1192. id: setup-agent-output-env
  1193. if: steps.download-agent-output.outcome == 'success'
  1194. run: |
  1195. mkdir -p /tmp/gh-aw/
  1196. find "/tmp/gh-aw/" -type f -print
  1197. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1198. - name: Download Safe Outputs Items Manifest
  1199. id: download-safe-outputs-manifest
  1200. if: always()
  1201. continue-on-error: true
  1202. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1203. with:
  1204. name: ${{ needs.activation.outputs.artifact_prefix }}safe-outputs-items
  1205. path: /tmp/gh-aw/
  1206. - name: Collect usage artifact files
  1207. if: always()
  1208. continue-on-error: true
  1209. run: bash "${RUNNER_TEMP}/gh-aw/actions/collect_usage_artifact_files.sh"
  1210. - name: Upload usage artifact
  1211. if: always()
  1212. continue-on-error: true
  1213. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1214. with:
  1215. name: ${{ needs.activation.outputs.artifact_prefix }}usage
  1216. path: |
  1217. /tmp/gh-aw/usage/aw_info.json
  1218. /tmp/gh-aw/usage/aw-info.jsonl
  1219. /tmp/gh-aw/usage/agent_usage.json
  1220. /tmp/gh-aw/usage/agent_usage.jsonl
  1221. /tmp/gh-aw/usage/detection_usage.jsonl
  1222. /tmp/gh-aw/usage/evals.jsonl
  1223. /tmp/gh-aw/usage/github_rate_limits.jsonl
  1224. /tmp/gh-aw/usage/agent/token_usage.jsonl
  1225. /tmp/gh-aw/usage/detection/token_usage.jsonl
  1226. /tmp/gh-aw/usage/activity/summary.json
  1227. if-no-files-found: ignore
  1228. - name: Restore daily AIC usage cache
  1229. id: restore-daily-aic-cache-conclusion
  1230. if: always()
  1231. continue-on-error: true
  1232. uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
  1233. with:
  1234. key: agentic-workflow-usage-issuehandlequestion-${{ github.run_id }}
  1235. restore-keys: agentic-workflow-usage-issuehandlequestion-
  1236. path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
  1237. - name: Write daily AIC usage cache entry
  1238. id: write-daily-aic-cache
  1239. if: always()
  1240. continue-on-error: true
  1241. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1242. with:
  1243. github-token: ${{ github.token }}
  1244. script: |
  1245. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1246. setupGlobals(core, github, context);
  1247. const { main } = require('${{ runner.temp }}/gh-aw/actions/write_daily_aic_usage_cache.cjs');
  1248. await main();
  1249. - name: Save daily AIC usage cache
  1250. id: save-daily-aic-cache
  1251. if: always()
  1252. continue-on-error: true
  1253. uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
  1254. with:
  1255. key: agentic-workflow-usage-issuehandlequestion-${{ github.run_id }}
  1256. path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
  1257. - name: Upload daily AIC usage cache artifact
  1258. id: upload-daily-aic-cache
  1259. if: always()
  1260. continue-on-error: true
  1261. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1262. with:
  1263. name: aic-usage-cache
  1264. path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
  1265. if-no-files-found: ignore
  1266. retention-days: 7
  1267. - name: Process no-op messages
  1268. id: noop
  1269. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1270. env:
  1271. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1272. GH_AW_NOOP_MAX: "1"
  1273. GH_AW_WORKFLOW_NAME: "Issue Handle Question"
  1274. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-question.md"
  1275. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1276. GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
  1277. GH_AW_NOOP_REPORT_AS_ISSUE: "false"
  1278. GH_AW_AIC: ${{ needs.agent.outputs.aic }}
  1279. GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }}
  1280. GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }}
  1281. GH_AW_WORKFLOW_ID: "issue-handle-question"
  1282. with:
  1283. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1284. script: |
  1285. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1286. setupGlobals(core, github, context, exec, io, getOctokit);
  1287. const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_noop_message.cjs');
  1288. await main();
  1289. - name: Log detection run
  1290. id: detection_runs
  1291. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1292. env:
  1293. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1294. GH_AW_WORKFLOW_NAME: "Issue Handle Question"
  1295. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-question.md"
  1296. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1297. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  1298. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  1299. with:
  1300. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1301. script: |
  1302. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1303. setupGlobals(core, github, context, exec, io, getOctokit);
  1304. const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_detection_runs.cjs');
  1305. await main();
  1306. - name: Record missing tool
  1307. id: missing_tool
  1308. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1309. env:
  1310. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1311. GH_AW_MISSING_TOOL_CREATE_ISSUE: "true"
  1312. GH_AW_WORKFLOW_NAME: "Issue Handle Question"
  1313. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-question.md"
  1314. with:
  1315. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1316. script: |
  1317. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1318. setupGlobals(core, github, context, exec, io, getOctokit);
  1319. const { main } = require('${{ runner.temp }}/gh-aw/actions/missing_tool.cjs');
  1320. await main();
  1321. - name: Record incomplete
  1322. id: report_incomplete
  1323. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1324. env:
  1325. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1326. GH_AW_REPORT_INCOMPLETE_CREATE_ISSUE: "true"
  1327. GH_AW_WORKFLOW_NAME: "Issue Handle Question"
  1328. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-question.md"
  1329. with:
  1330. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1331. script: |
  1332. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1333. setupGlobals(core, github, context, exec, io, getOctokit);
  1334. const { main } = require('${{ runner.temp }}/gh-aw/actions/report_incomplete_handler.cjs');
  1335. await main();
  1336. - name: Handle agent failure
  1337. id: handle_agent_failure
  1338. if: always()
  1339. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1340. env:
  1341. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1342. GH_AW_WORKFLOW_NAME: "Issue Handle Question"
  1343. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-question.md"
  1344. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1345. GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
  1346. GH_AW_WORKFLOW_ID: "issue-handle-question"
  1347. GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168"
  1348. GH_AW_ENGINE_ID: "codex"
  1349. GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }}
  1350. GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }}
  1351. GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }}
  1352. GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }}
  1353. GH_AW_UNKNOWN_MODEL_AI_CREDITS: ${{ needs.agent.outputs.unknown_model_ai_credits || 'false' }}
  1354. GH_AW_AIC: ${{ needs.agent.outputs.aic }}
  1355. GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }}
  1356. GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }}
  1357. GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
  1358. GH_AW_MCP_POLICY_ERROR: ${{ needs.agent.outputs.mcp_policy_error }}
  1359. GH_AW_AGENTIC_ENGINE_TIMEOUT: ${{ needs.agent.outputs.agentic_engine_timeout }}
  1360. GH_AW_MODEL_NOT_SUPPORTED_ERROR: ${{ needs.agent.outputs.model_not_supported_error }}
  1361. GH_AW_HTTP_400_RESPONSE_ERROR: ${{ needs.agent.outputs.http_400_response_error }}
  1362. GH_AW_MAX_CACHE_MISSES_EXCEEDED: ${{ needs.agent.outputs.max_cache_misses_exceeded }}
  1363. GH_AW_MISSING_MODEL_PRICING_ERROR: ${{ needs.agent.outputs.missing_model_pricing_error }}
  1364. GH_AW_MISSING_MODEL_PRICING_MODEL_NAME: ${{ needs.agent.outputs.missing_model_pricing_model_name }}
  1365. GH_AW_ENGINE_API_HOSTS: "api.openai.com"
  1366. GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }}
  1367. GH_AW_OAUTH_TOKEN_CHECK_FAILED: ${{ needs.activation.outputs.oauth_token_check_failed }}
  1368. GH_AW_STALE_LOCK_FILE_FAILED: ${{ needs.activation.outputs.stale_lock_file_failed }}
  1369. GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
  1370. GH_AW_DAILY_AI_CREDITS_TOTAL_EFFECTIVE_TOKENS: ${{ needs.activation.outputs.daily_ai_credits_total_effective_tokens }}
  1371. GH_AW_DAILY_AI_CREDITS_THRESHOLD: ${{ needs.activation.outputs.daily_ai_credits_threshold }}
  1372. GH_AW_GROUP_REPORTS: "false"
  1373. GH_AW_FAILURE_REPORT_AS_ISSUE: "true"
  1374. GH_AW_MISSING_TOOL_REPORT_AS_FAILURE: "true"
  1375. GH_AW_MISSING_DATA_REPORT_AS_FAILURE: "true"
  1376. GH_AW_TIMEOUT_MINUTES: "15"
  1377. with:
  1378. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1379. script: |
  1380. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1381. setupGlobals(core, github, context, exec, io, getOctokit);
  1382. const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_agent_failure.cjs');
  1383. await main();
  1384. - name: Report failed jobs
  1385. id: report_failed_jobs
  1386. if: always()
  1387. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1388. env:
  1389. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1390. GH_AW_WORKFLOW_NAME: "Issue Handle Question"
  1391. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-question.md"
  1392. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1393. GH_AW_REPORT_FAILED_JOBS: "true"
  1394. with:
  1395. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1396. script: |
  1397. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1398. setupGlobals(core, github, context, exec, io, getOctokit);
  1399. const { main } = require('${{ runner.temp }}/gh-aw/actions/report_failed_jobs.cjs');
  1400. await main();
  1401. detection:
  1402. needs:
  1403. - activation
  1404. - agent
  1405. if: always() && needs.agent.result != 'skipped'
  1406. runs-on: ubuntu-latest
  1407. permissions:
  1408. contents: read
  1409. env:
  1410. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  1411. outputs:
  1412. aic: ${{ steps.parse_detection_token_usage.outputs.aic }}
  1413. detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
  1414. detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
  1415. detection_success: ${{ steps.detection_conclusion.outputs.success }}
  1416. steps:
  1417. - name: Setup Scripts
  1418. id: setup
  1419. uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
  1420. with:
  1421. destination: ${{ runner.temp }}/gh-aw/actions
  1422. job-name: ${{ github.job }}
  1423. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1424. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  1425. env:
  1426. GH_AW_SETUP_WORKFLOW_NAME: "Issue Handle Question"
  1427. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-handle-question.lock.yml@${{ github.ref }}
  1428. GH_AW_INFO_VERSION: "0.147.0"
  1429. GH_AW_INFO_AWF_VERSION: "v0.27.44"
  1430. GH_AW_INFO_ENGINE_ID: "codex"
  1431. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  1432. - name: Download agent output artifact
  1433. id: download-agent-output
  1434. continue-on-error: true
  1435. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1436. with:
  1437. name: ${{ needs.agent.outputs.artifact_prefix }}agent
  1438. path: /tmp/gh-aw/
  1439. - name: Setup agent output environment variable
  1440. id: setup-agent-output-env
  1441. if: steps.download-agent-output.outcome == 'success'
  1442. run: |
  1443. mkdir -p /tmp/gh-aw/
  1444. find "/tmp/gh-aw/" -type f -print
  1445. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1446. - name: Checkout repository for patch context
  1447. if: needs.agent.outputs.has_patch == 'true'
  1448. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  1449. with:
  1450. persist-credentials: false
  1451. # --- Threat Detection ---
  1452. - name: Clean stale firewall files from agent artifact
  1453. run: |
  1454. rm -rf /tmp/gh-aw/sandbox/firewall/logs
  1455. rm -rf /tmp/gh-aw/sandbox/firewall/audit
  1456. - name: Check if detection needed
  1457. id: detection_guard
  1458. if: always()
  1459. env:
  1460. OUTPUT_TYPES: ${{ needs.agent.outputs.output_types }}
  1461. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1462. run: |
  1463. if [[ -n "$OUTPUT_TYPES" || "$HAS_PATCH" == "true" ]]; then
  1464. echo "run_detection=true" >> "$GITHUB_OUTPUT"
  1465. echo "Detection will run: output_types=$OUTPUT_TYPES, has_patch=$HAS_PATCH"
  1466. else
  1467. echo "run_detection=false" >> "$GITHUB_OUTPUT"
  1468. echo "Detection skipped: no agent outputs or patches to analyze"
  1469. fi
  1470. - name: Clear MCP Config for detection
  1471. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1472. run: |
  1473. rm -f "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json"
  1474. rm -f "$HOME/.copilot/mcp-config.json"
  1475. rm -f "$GITHUB_WORKSPACE/.gemini/settings.json"
  1476. - name: Prepare threat detection files
  1477. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1478. run: |
  1479. bash "${RUNNER_TEMP}/gh-aw/actions/prepare_threat_detection_files.sh"
  1480. - name: Setup threat detection
  1481. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1482. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1483. env:
  1484. WORKFLOW_NAME: "Issue Handle Question"
  1485. WORKFLOW_DESCRIPTION: "处理分类为 question 的 issue,进行问题分析、咨询和解答"
  1486. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1487. GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
  1488. with:
  1489. script: |
  1490. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1491. setupGlobals(core, github, context, exec, io, getOctokit);
  1492. const { main } = require('${{ runner.temp }}/gh-aw/actions/setup_threat_detection.cjs');
  1493. await main();
  1494. - name: Ensure threat-detection directory and log
  1495. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1496. run: |
  1497. mkdir -p /tmp/gh-aw/threat-detection
  1498. touch /tmp/gh-aw/threat-detection/detection.log
  1499. rm -f /tmp/gh-aw/step-summary.md
  1500. touch /tmp/gh-aw/step-summary.md
  1501. - name: Setup Node.js
  1502. uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
  1503. with:
  1504. node-version: '24'
  1505. package-manager-cache: false
  1506. - name: Install Codex CLI
  1507. run: npm install --ignore-scripts -g @openai/codex@0.147.0
  1508. - name: Install AWF binary
  1509. run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.27.44
  1510. - name: Download container images
  1511. run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.27.44@sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4 ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44@sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7 ghcr.io/github/gh-aw-firewall/squid:0.27.44@sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627 ghcr.io/github/gh-aw-mcpg:v0.4.9@sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f
  1512. - name: Start MCP Gateway
  1513. id: start-mcp-gateway
  1514. env:
  1515. CODEX_HOME: /tmp/gh-aw/mcp-config
  1516. run: |
  1517. set -eo pipefail
  1518. mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config"
  1519. # Export gateway environment variables for MCP config and gateway script
  1520. export MCP_GATEWAY_PORT="8080"
  1521. export MCP_GATEWAY_DOMAIN="host.docker.internal"
  1522. export MCP_GATEWAY_HOST_DOMAIN="localhost"
  1523. MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
  1524. echo "::add-mask::${MCP_GATEWAY_API_KEY}"
  1525. export MCP_GATEWAY_API_KEY
  1526. export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads"
  1527. mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}"
  1528. export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288"
  1529. export MCP_GATEWAY_ALLOWED_MOUNT_ROOTS="${GITHUB_WORKSPACE}:rw,${RUNNER_TEMP}/gh-aw:ro,${RUNNER_TEMP}/gh-aw/safeoutputs:rw,/opt:ro,/tmp:rw,/usr/bin/gh:ro"
  1530. export DEBUG="*"
  1531. export GH_AW_ENGINE="codex"
  1532. MCP_GATEWAY_UID=$(id -u 2>/dev/null || echo '0')
  1533. MCP_GATEWAY_GID=$(id -g 2>/dev/null || echo '0')
  1534. source "${RUNNER_TEMP}/gh-aw/actions/resolve_docker_socket_gid.sh"
  1535. export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host --name awmg-mcpg --add-host host.docker.internal:127.0.0.1 --user '"${MCP_GATEWAY_UID}"':'"${MCP_GATEWAY_GID}"' --group-add '"${DOCKER_SOCK_GID}"' -v '"${DOCKER_SOCK_PATH}"':/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 DOCKER_HOST=unix:///var/run/docker.sock -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_POLICY_ALLOW_CREATE_PULL_REQUEST -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 GH_AW_SINK_VISIBILITY -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 RUNNER_TEMP -e MCP_GATEWAY_ALLOWED_MOUNT_ROOTS -e CODEX_HOME -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 -v '"${RUNNER_TEMP}"'/gh-aw/safeoutputs:'"${RUNNER_TEMP}"'/gh-aw/safeoutputs:rw ghcr.io/github/gh-aw-mcpg:v0.4.9'
  1536. cat > "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" << GH_AW_MCP_CONFIG_2f5d9885311152cf_EOF
  1537. [history]
  1538. persistence = "none"
  1539. [shell_environment_policy]
  1540. inherit = "core"
  1541. include_only = ["^CODEX_API_KEY$", "^HOME$", "^OPENAI_API_KEY$", "^PATH$"]
  1542. GH_AW_MCP_CONFIG_2f5d9885311152cf_EOF
  1543. # Generate JSON config for MCP gateway
  1544. GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node)
  1545. cat << GH_AW_MCP_CONFIG_124f4e7dd5e01bb9_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs"
  1546. {
  1547. "mcpServers": {
  1548. },
  1549. "gateway": {
  1550. "port": $MCP_GATEWAY_PORT,
  1551. "domain": "${MCP_GATEWAY_DOMAIN}",
  1552. "apiKey": "${MCP_GATEWAY_API_KEY}",
  1553. "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}",
  1554. "startupTimeout": 120
  1555. }
  1556. }
  1557. GH_AW_MCP_CONFIG_124f4e7dd5e01bb9_EOF
  1558. # Sync converter output to writable CODEX_HOME for Codex
  1559. mkdir -p /tmp/gh-aw/mcp-config
  1560. cat > "/tmp/gh-aw/mcp-config/config.toml" << GH_AW_CODEX_SHELL_POLICY_f48e0018706875a8_EOF
  1561. model_provider = "openai-proxy"
  1562. [model_providers.openai-proxy]
  1563. name = "OpenAI AWF proxy"
  1564. base_url = "http://172.30.0.30:10000"
  1565. env_key = "OPENAI_API_KEY"
  1566. supports_websockets = false
  1567. [shell_environment_policy]
  1568. inherit = "core"
  1569. include_only = ["^CODEX_API_KEY$", "^HOME$", "^OPENAI_API_KEY$", "^PATH$"]
  1570. GH_AW_CODEX_SHELL_POLICY_f48e0018706875a8_EOF
  1571. awk '
  1572. BEGIN { skip_openai_proxy = 0 }
  1573. /^[[:space:]]*model_provider[[:space:]]*=/ { next }
  1574. /^\[model_providers\.openai-proxy\][[:space:]]*$/ { skip_openai_proxy = 1; next }
  1575. /^\[/ { skip_openai_proxy = 0 }
  1576. !skip_openai_proxy { print }
  1577. ' "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" >> "/tmp/gh-aw/mcp-config/config.toml"
  1578. chmod 600 "/tmp/gh-aw/mcp-config/config.toml"
  1579. mkdir -p "${CODEX_HOME}"
  1580. if [ "/tmp/gh-aw/mcp-config/config.toml" != "${CODEX_HOME}/config.toml" ]; then cp "/tmp/gh-aw/mcp-config/config.toml" "${CODEX_HOME}/config.toml"; fi
  1581. chmod 600 "${CODEX_HOME}/config.toml"
  1582. - name: Execute Codex CLI
  1583. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1584. continue-on-error: true
  1585. id: detection_agentic_execution
  1586. timeout-minutes: 20
  1587. run: |
  1588. set -o pipefail
  1589. printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt
  1590. mkdir -p "$CODEX_HOME/logs" && touch /tmp/gh-aw/agent-step-summary.md && mkdir -p /tmp/gh-aw/threat-detection && printf '%s' '{"type":"object","properties":{"prompt_injection":{"type":"boolean"},"secret_leak":{"type":"boolean"},"malicious_patch":{"type":"boolean"},"reasons":{"type":"array","items":{"type":"string"}}},"required":["prompt_injection","secret_leak","malicious_patch","reasons"],"additionalProperties":false}' > /tmp/gh-aw/threat-detection/detection_schema.json
  1591. (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
  1592. GH_AW_MAX_AI_CREDITS="${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }}"
  1593. printf '%s\n' "{\"\$schema\":\"https://github.com/github/gh-aw-firewall/releases/download/v0.27.44/awf-config.schema.json\",\"network\":{\"allowDomains\":[\"172.30.0.1\",\"ai-pixel.online\",\"api-inference.modelscope.cn\",\"api.commandcode.ai\",\"api.deepseek.com\",\"api.github.com\",\"api.minimaxi.com\",\"api.openai.com\",\"chatgpt.com\",\"github.com\",\"host.docker.internal\",\"open.bigmodel.cn\",\"openai.com\",\"opencode.ai\"]},\"apiProxy\":{\"enabled\":true,\"enableTokenSteering\":true,\"maxRuns\":500,\"maxAiCredits\":${GH_AW_MAX_AI_CREDITS},\"maxCacheMisses\":5,\"targets\":{\"openai\":{\"host\":\"api.ai-pixel.online\"}},\"models\":{\"agent\":[\"sonnet-6x\",\"gpt-5.4\",\"gpt-5.5\",\"gpt-5.6\",\"gpt-5.3\",\"gemini-pro\",\"any\"],\"antigravity\":[\"copilot/antigravity*\",\"google/antigravity*\",\"gemini/antigravity*\"],\"any\":[\"copilot/*\",\"anthropic/*\",\"openai/*\",\"google/*\",\"gemini/*\"],\"auto\":[\"copilot/auto\",\"large\"],\"claude\":[\"agent\"],\"codex\":[\"agent\"],\"coding\":[\"copilot/gpt-5*codex*\",\"openai/gpt-5*codex*\",\"gpt-5-codex\",\"kimi\"],\"computer-use\":[\"copilot/*computer-use*\",\"google/*computer-use*\",\"gemini/*computer-use*\",\"openai/*computer-use*\"],\"copilot\":[\"agent\"],\"deep-research\":[\"copilot/deep-research*\",\"copilot/o3-deep-research*\",\"copilot/o4-mini-deep-research*\",\"google/deep-research*\",\"gemini/deep-research*\",\"openai/o3-deep-research*\",\"openai/o4-mini-deep-research*\"],\"detection\":[\"small\"],\"evals\":[\"small\"],\"fable\":[\"copilot/*fable*\",\"anthropic/*fable*\"],\"gemini\":[\"agent\"],\"gemini-3-flash\":[\"copilot/gemini-3*flash*\",\"google/gemini-3*flash*\",\"gemini/gemini-3*flash*\"],\"gemini-3-pro\":[\"copilot/gemini-3*pro*\",\"google/gemini-3*pro*\",\"google/nano-banana*\",\"gemini/gemini-3*pro*\"],\"gemini-3.1-flash\":[\"copilot/gemini-3.1*flash*\",\"google/gemini-3.1*flash*\",\"gemini/gemini-3.1*flash*\"],\"gemini-3.1-pro\":[\"copilot/gemini-3.1*pro*\",\"google/gemini-3.1*pro*\",\"gemini/gemini-3.1*pro*\"],\"gemini-3.5-flash\":[\"copilot/gemini-3.5*flash*\",\"google/gemini-3.5*flash*\",\"gemini/gemini-3.5*flash*\"],\"gemini-3.6-flash\":[\"copilot/gemini-3.6*flash*\",\"google/gemini-3.6*flash*\",\"gemini/gemini-3.6*flash*\"],\"gemini-flash\":[\"copilot/gemini-*flash*\",\"google/gemini-*flash*\",\"gemini/gemini-*flash*\"],\"gemini-flash-lite\":[\"copilot/gemini-*flash*lite*\",\"google/gemini-*flash*lite*\",\"gemini/gemini-*flash*lite*\"],\"gemini-omni\":[\"copilot/gemini-omni*\",\"google/gemini-omni*\",\"gemini/gemini-omni*\"],\"gemini-pro\":[\"copilot/gemini-*pro*\",\"google/gemini-*pro*\",\"gemini/gemini-*pro*\"],\"gemma\":[\"copilot/gemma*\",\"google/gemma*\",\"gemini/gemma*\"],\"gpt-5\":[\"copilot/gpt-5*\",\"openai/gpt-5*\"],\"gpt-5-codex\":[\"copilot/gpt-5*codex*\",\"openai/gpt-5*codex*\"],\"gpt-5-mini\":[\"copilot/gpt-5*mini*\",\"openai/gpt-5*mini*\"],\"gpt-5-nano\":[\"copilot/gpt-5*nano*\",\"openai/gpt-5*nano*\"],\"gpt-5-pro\":[\"copilot/gpt-5*pro*\",\"openai/gpt-5*pro*\"],\"gpt-5.1\":[\"copilot/gpt-5.1*\",\"openai/gpt-5.1*\"],\"gpt-5.2\":[\"copilot/gpt-5.2*\",\"openai/gpt-5.2*\"],\"gpt-5.3\":[\"copilot/gpt-5.3*\",\"openai/gpt-5.3*\"],\"gpt-5.4\":[\"copilot/gpt-5.4*\",\"openai/gpt-5.4*\"],\"gpt-5.5\":[\"copilot/gpt-5.5*\",\"openai/gpt-5.5*\"],\"gpt-5.6\":[\"copilot/gpt-5.6*\",\"openai/gpt-5.6*\"],\"grok\":[\"copilot/*grok*\",\"openai/*grok*\"],\"haiku\":[\"copilot/*haiku*\",\"anthropic/*haiku*\"],\"image-generation\":[\"copilot/gpt-image*\",\"openai/gpt-image*\",\"openai/chatgpt-image*\",\"copilot/gemini-*image*\",\"google/gemini-*image*\",\"gemini/gemini-*image*\",\"google/imagen*\"],\"kimi\":[\"copilot/kimi*\",\"openai/kimi*\"],\"kiwi\":[\"copilot/kiwi*\",\"openai/kiwi*\"],\"large\":[\"sonnet\",\"gpt-5-pro\",\"gpt-5\",\"gemini-pro\"],\"lyria\":[\"google/lyria*\",\"gemini/lyria*\",\"copilot/lyria*\"],\"mai-code\":[\"copilot/MAI-Code*\",\"copilot/mai-code*\",\"openai/MAI-Code*\"],\"mai-code-1-flash-picker\":[\"copilot/MAI-Code-1-Flash-picker*\",\"copilot/mai-code-1-flash-picker*\",\"openai/MAI-Code-1-Flash-picker*\"],\"mini\":[\"haiku\",\"gpt-5-mini\",\"gpt-5-nano\",\"gemini-flash-lite\"],\"nano-banana\":[\"copilot/nano-banana*\",\"google/nano-banana*\",\"gemini/nano-banana*\"],\"opus\":[\"copilot/*opus*\",\"anthropic/*opus*\"],\"opusplan\":[\"opus?effort=high\"],\"raptor-mini\":[\"copilot/raptor*\",\"openai/raptor*\"],\"reasoning\":[\"copilot/o1*\",\"copilot/o3*\",\"copilot/o4*\",\"openai/o1*\",\"openai/o3*\",\"openai/o4*\"],\"robotics\":[\"copilot/*robotics*\",\"google/*robotics*\",\"gemini/*robotics*\"],\"small\":[\"mini\"],\"small-agent\":[\"haiku\",\"gpt-5-mini\",\"gemini-flash\"],\"sonnet\":[\"copilot/*sonnet*\",\"anthropic/*sonnet*\"],\"sonnet-6x\":[\"copilot/*sonnet-4.5*\",\"copilot/*sonnet-4.6*\",\"copilot/*sonnet-5*\",\"copilot/*sonnet-4-5-*\",\"anthropic/*sonnet-4-5-*\",\"copilot/*sonnet-4-6*\",\"anthropic/*sonnet-4-6*\",\"anthropic/*sonnet-5*\"],\"summarization\":[\"haiku\",\"gpt-5-mini\",\"gemini-flash-lite\",\"mini\"],\"veo\":[\"google/veo*\",\"gemini/veo*\"],\"vision\":[\"copilot/gemini-*image*\",\"google/gemini-*image*\",\"gemini/gemini-*image*\",\"copilot/gemini-*flash*\",\"google/gemini-*flash*\",\"gemini/gemini-*flash*\"]}},\"container\":{\"imageTag\":\"0.27.44,squid=sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627,agent=sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4,api-proxy=sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7,cli-proxy=sha256:c064d15974f7c933ec7d3f7b4038f4fd203547b3154bdc821afd379144887eff\"},\"logging\":{\"proxyLogsDir\":\"/tmp/gh-aw/sandbox/firewall/logs\",\"auditDir\":\"/tmp/gh-aw/sandbox/firewall/audit\"}}" > "${RUNNER_TEMP}/gh-aw/awf-config.json"
  1594. cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json
  1595. export GH_AW_MODELS_JSON_PATH="/tmp/gh-aw/models.json"
  1596. GH_AW_DOCKER_HOST=""
  1597. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  1598. GH_AW_DOCKER_HOST="${DOCKER_HOST}"
  1599. fi
  1600. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  1601. _GH_AW_CHROOT_JSON=$(jq -c --arg src "${RUNNER_TEMP}/gh-aw" --arg user "$(id -un)" --argjson uid "$(id -u)" --argjson gid "$(id -g)" --arg home "${RUNNER_TEMP}/gh-aw/home" '.chroot={"binariesSourcePath":$src,"identity":{"user":$user,"uid":$uid,"gid":$gid,"home":$home}}' "${RUNNER_TEMP}/gh-aw/awf-config.json") || { echo "chroot config patch failed" >&2; exit 1; }
  1602. printf '%s\n' "$_GH_AW_CHROOT_JSON" > "${RUNNER_TEMP}/gh-aw/awf-config.json"
  1603. printf '%s\n' "$_GH_AW_CHROOT_JSON" > "${RUNNER_TEMP}/gh-aw/awf-config.json"
  1604. fi
  1605. GH_AW_TOOL_CACHE_MOUNT=""
  1606. GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"
  1607. if [ -d "$GH_AW_TOOL_CACHE" ]; then
  1608. if [[ "$GH_AW_TOOL_CACHE" != /opt/* ]]; then
  1609. GH_AW_TOOL_CACHE_MOUNT="$GH_AW_TOOL_CACHE:$GH_AW_TOOL_CACHE:ro"
  1610. fi
  1611. fi
  1612. # shellcheck disable=SC1003,SC2016,SC2086
  1613. awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --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" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST:+--docker-host "$GH_AW_DOCKER_HOST"} --env-all --exclude-env ACTIONS_ID_TOKEN_REQUEST_TOKEN --exclude-env ACTIONS_ID_TOKEN_REQUEST_URL --exclude-env CODEX_API_KEY --exclude-env OPENAI_API_KEY --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --skip-pull \
  1614. -- /bin/bash -c 'set +o histexpand; : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; export PATH="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true; [ -n "$ERLANG_HOME" ] && export PATH="$ERLANG_HOME/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; GH_AW_NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null || true)"; if [ -n "$GH_AW_NPM_GLOBAL_ROOT" ]; then export NODE_PATH="${GH_AW_NPM_GLOBAL_ROOT}${NODE_PATH:+:${NODE_PATH}}"; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/codex_harness.cjs codex exec${GH_AW_MODEL_DETECTION_CODEX:+ --model "$GH_AW_MODEL_DETECTION_CODEX"} -c web_search="disabled" -c fetch="disabled" --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check --output-schema /tmp/gh-aw/threat-detection/detection_schema.json -o /tmp/gh-aw/threat-detection/detection_result.json --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log
  1615. env:
  1616. GITHUB_STEP_SUMMARY: /tmp/gh-aw/step-summary.md
  1617. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }}
  1618. CODEX_HOME: /tmp/gh-aw/mcp-config
  1619. GH_AW_MAX_TURNS: ${{ vars.GH_AW_DEFAULT_MAX_TURNS || '' }}
  1620. GH_AW_MCP_CONFIG: ${{ runner.temp }}/gh-aw/mcp-config/config.toml
  1621. GH_AW_MODEL_DETECTION_CODEX: gpt-5.6-luna
  1622. GH_AW_PHASE: detection
  1623. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  1624. GH_AW_VERSION: v0.86.2
  1625. GITHUB_AW: true
  1626. GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
  1627. GIT_AUTHOR_NAME: github-actions[bot]
  1628. GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
  1629. GIT_COMMITTER_NAME: github-actions[bot]
  1630. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1631. OPENAI_BASE_URL: https://api.ai-pixel.online
  1632. RUNNER_TEMP: ${{ runner.temp }}
  1633. RUST_LOG: ${{ runner.debug == 1 && 'trace,hyper_util=info,mio=info,reqwest=info,os_info=info,codex_otel=warn,codex_core=debug,ocodex_exec=debug' || 'warn' }}
  1634. TRACEPARENT: ${{ env.GITHUB_AW_OTEL_TRACE_ID != '' && env.GITHUB_AW_OTEL_PARENT_SPAN_ID != '' && format('00-{0}-{1}-01', env.GITHUB_AW_OTEL_TRACE_ID, env.GITHUB_AW_OTEL_PARENT_SPAN_ID) || '' }}
  1635. - name: Echo detection step summary
  1636. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1637. continue-on-error: true
  1638. run: |
  1639. if [ -s /tmp/gh-aw/step-summary.md ]; then
  1640. cat /tmp/gh-aw/step-summary.md
  1641. fi
  1642. - name: Render detection log
  1643. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1644. continue-on-error: true
  1645. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1646. with:
  1647. script: |
  1648. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1649. setupGlobals(core, github, context, exec, io, getOctokit);
  1650. const { main } = require('${{ runner.temp }}/gh-aw/actions/render_detection_log.cjs');
  1651. await main();
  1652. - name: Parse threat detection token usage for step summary
  1653. id: parse_detection_token_usage
  1654. if: always()
  1655. continue-on-error: true
  1656. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1657. env:
  1658. GH_AW_TOKEN_USAGE_SUMMARY_TITLE: Threat Detection Token Usage
  1659. with:
  1660. script: |
  1661. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1662. setupGlobals(core, github, context, exec, io, getOctokit);
  1663. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_token_usage.cjs');
  1664. await main();
  1665. - name: Upload threat detection log
  1666. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1667. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1668. with:
  1669. name: ${{ needs.agent.outputs.artifact_prefix }}detection
  1670. path: /tmp/gh-aw/threat-detection/detection.log
  1671. if-no-files-found: ignore
  1672. - name: Parse and conclude threat detection
  1673. id: detection_conclusion
  1674. if: always()
  1675. continue-on-error: true
  1676. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1677. env:
  1678. RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
  1679. DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
  1680. GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
  1681. with:
  1682. script: |
  1683. try {
  1684. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1685. setupGlobals(core, github, context, exec, io, getOctokit);
  1686. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_threat_detection_results.cjs');
  1687. await main();
  1688. } catch (loadErr) {
  1689. const continueOnError = process.env.GH_AW_DETECTION_CONTINUE_ON_ERROR !== 'false';
  1690. const detectionExecutionFailed = process.env.DETECTION_AGENTIC_EXECUTION_OUTCOME === 'failure';
  1691. const msg = 'ERR_SYSTEM: \u274C Unexpected error loading threat detection module: ' + (loadErr && loadErr.message ? loadErr.message : String(loadErr));
  1692. core.error(msg);
  1693. core.setOutput('reason', 'parse_error');
  1694. if (continueOnError && !detectionExecutionFailed) {
  1695. core.warning('\u26A0\uFE0F ' + msg);
  1696. core.setOutput('conclusion', 'warning');
  1697. core.setOutput('success', 'false');
  1698. } else {
  1699. core.setOutput('conclusion', 'failure');
  1700. core.setOutput('success', 'false');
  1701. core.setFailed(msg);
  1702. }
  1703. }
  1704. safe_outputs:
  1705. needs:
  1706. - activation
  1707. - agent
  1708. - detection
  1709. if: (!cancelled()) && needs.agent.result != 'skipped' && needs.detection.result == 'success'
  1710. runs-on: ubuntu-slim
  1711. permissions:
  1712. issues: write
  1713. pull-requests: write
  1714. timeout-minutes: 45
  1715. env:
  1716. GH_AW_AGENT_AIC: ${{ needs.agent.outputs.aic }}
  1717. GH_AW_AIC: ${{ needs.agent.outputs.aic }}
  1718. GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }}
  1719. GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/issue-handle-question"
  1720. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  1721. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  1722. GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens }}
  1723. GH_AW_ENGINE_ID: "codex"
  1724. GH_AW_ENGINE_MODEL: "gpt-5.6-luna"
  1725. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  1726. GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }}
  1727. GH_AW_WORKFLOW_ID: "issue-handle-question"
  1728. GH_AW_WORKFLOW_NAME: "Issue Handle Question"
  1729. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-handle-question.md"
  1730. outputs:
  1731. code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }}
  1732. code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }}
  1733. comment_id: ${{ steps.process_safe_outputs.outputs.comment_id }}
  1734. comment_url: ${{ steps.process_safe_outputs.outputs.comment_url }}
  1735. create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }}
  1736. create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }}
  1737. process_safe_outputs_items_applied: ${{ steps.process_safe_outputs.outputs.items_applied }}
  1738. process_safe_outputs_items_cancelled: ${{ steps.process_safe_outputs.outputs.items_cancelled }}
  1739. process_safe_outputs_items_deferred: ${{ steps.process_safe_outputs.outputs.items_deferred }}
  1740. process_safe_outputs_items_failed: ${{ steps.process_safe_outputs.outputs.items_failed }}
  1741. process_safe_outputs_items_skipped: ${{ steps.process_safe_outputs.outputs.items_skipped }}
  1742. process_safe_outputs_items_succeeded: ${{ steps.process_safe_outputs.outputs.items_succeeded }}
  1743. process_safe_outputs_items_warnings: ${{ steps.process_safe_outputs.outputs.items_warnings }}
  1744. process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }}
  1745. process_safe_outputs_status: ${{ steps.process_safe_outputs.outputs.status }}
  1746. process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }}
  1747. steps:
  1748. - name: Setup Scripts
  1749. id: setup
  1750. uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
  1751. with:
  1752. destination: ${{ runner.temp }}/gh-aw/actions
  1753. job-name: ${{ github.job }}
  1754. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1755. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  1756. env:
  1757. GH_AW_SETUP_WORKFLOW_NAME: "Issue Handle Question"
  1758. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-handle-question.lock.yml@${{ github.ref }}
  1759. GH_AW_INFO_VERSION: "0.147.0"
  1760. GH_AW_INFO_AWF_VERSION: "v0.27.44"
  1761. GH_AW_INFO_ENGINE_ID: "codex"
  1762. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  1763. - name: Download agent output artifact
  1764. id: download-agent-output
  1765. continue-on-error: true
  1766. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1767. with:
  1768. name: ${{ needs.activation.outputs.artifact_prefix }}agent
  1769. path: /tmp/gh-aw/
  1770. - name: Setup agent output environment variable
  1771. id: setup-agent-output-env
  1772. if: steps.download-agent-output.outcome == 'success'
  1773. run: |
  1774. mkdir -p /tmp/gh-aw/
  1775. find "/tmp/gh-aw/" -type f -print
  1776. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1777. - name: Configure GH_HOST for enterprise compatibility
  1778. id: ghes-host-config
  1779. shell: bash
  1780. run: | # zizmor: ignore[github-env] - GITHUB_SERVER_URL is set by GitHub Actions, not user input.
  1781. # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct
  1782. # GitHub instance (GHES/GHEC). On github.com this is a harmless no-op.
  1783. GH_HOST="${GITHUB_SERVER_URL#https://}"
  1784. GH_HOST="${GH_HOST#http://}"
  1785. echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV"
  1786. - name: Process Safe Outputs
  1787. id: process_safe_outputs
  1788. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1789. env:
  1790. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1791. GH_AW_COMMENT_ID: ${{ needs.activation.outputs.comment_id }}
  1792. GH_AW_ALLOWED_DOMAINS: "172.30.0.1,ai-pixel.online,api-inference.modelscope.cn,api.commandcode.ai,api.deepseek.com,api.github.com,api.minimaxi.com,api.openai.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,chatgpt.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,github.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"
  1793. GITHUB_SERVER_URL: ${{ github.server_url }}
  1794. GITHUB_API_URL: ${{ github.api_url }}
  1795. 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\":\"false\"},\"report_incomplete\":{},\"update_issue\":{\"allow_body\":true,\"max\":1,\"target\":\"${{ inputs.issue_number }}\"}}"
  1796. with:
  1797. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1798. script: |
  1799. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1800. setupGlobals(core, github, context, exec, io, getOctokit);
  1801. const { main } = require('${{ runner.temp }}/gh-aw/actions/process_safe_outputs.cjs');
  1802. await main();
  1803. - name: Upload Safe Outputs Items
  1804. if: always()
  1805. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1806. with:
  1807. name: ${{ needs.activation.outputs.artifact_prefix }}safe-outputs-items
  1808. path: |
  1809. /tmp/gh-aw/safe-output-items.jsonl
  1810. /tmp/gh-aw/temporary-id-map.json
  1811. if-no-files-found: ignore