issue-handle-question.lock.yml 127 KB

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