issue-triage.lock.yml 135 KB

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