issue-handle-question.lock.yml 94 KB

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