issue-triage.lock.yml 100 KB

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