issue-triage.lock.yml 155 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384
  1. # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"40378b21ca6a065ccd7d9ede65bc0b8f5046e912a88127a58d535bf103977235","body_hash":"a7dd6dc846c988e38b3e0292da02e0796f06da1e92c9fda5fb4724b52fd5c290","compiler_version":"v1.0.1","strict":true,"agent_id":"codex","agent_model":"gpt-5.6-luna","engine_versions":{"codex":"0.164.0"}}
  2. # gh-aw-manifest: {"version":1,"secrets":["CODEX_API_KEY","COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","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/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"221ba4f4319de6b8e809d1a15528b3ae6a818aa5","version":"v1.0.1"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.0","digest":"sha256:b14bd399376180b5649a9324be3b50fbfc82bfe8f0c80045840416b5a4e65b96","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.29.0@sha256:b14bd399376180b5649a9324be3b50fbfc82bfe8f0c80045840416b5a4e65b96"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.0","digest":"sha256:baff00b856a4bdc93bce134928c70af3d3492f2e518757115042040674d56b0b","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.0@sha256:baff00b856a4bdc93bce134928c70af3d3492f2e518757115042040674d56b0b"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.0","digest":"sha256:6e0cbf7f980beb78b5461563a8164f6439ca959bc93733d5a6b52972e523ed50","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.29.0@sha256:6e0cbf7f980beb78b5461563a8164f6439ca959bc93733d5a6b52972e523ed50"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.0","digest":"sha256:d3544a4222e7efeeeb38669d8a1af0c72691c55b8f6506b15aa5920f7f31b7bc","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.0@sha256:d3544a4222e7efeeeb38669d8a1af0c72691c55b8f6506b15aa5920f7f31b7bc"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:2c2ea524e648b91c8333ce246e3838fcf5b19ac70e45baac1a51b9207299749f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:2c2ea524e648b91c8333ce246e3838fcf5b19ac70e45baac1a51b9207299749f"},{"image":"ghcr.io/github/github-mcp-server:v2.0.3","digest":"sha256:250bc6ce70788207608ef74cef4397230ff2e8481218da74d6093e4bd9101132","pinned_image":"ghcr.io/github/github-mcp-server:v2.0.3@sha256:250bc6ce70788207608ef74cef4397230ff2e8481218da74d6093e4bd9101132"}],"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","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false}
  3. # This file was automatically generated by gh-aw (v1.0.1). 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_ENDPOINT
  37. # - GH_AW_DEFAULT_OTLP_HEADERS
  38. # - GH_AW_GITHUB_MCP_SERVER_TOKEN
  39. # - GH_AW_GITHUB_TOKEN
  40. # - GITHUB_TOKEN
  41. # - OPENAI_API_KEY
  42. # - PIXEL_API_KEY
  43. #
  44. # Custom actions used:
  45. # - actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  46. # - actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
  47. # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  48. # - actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
  49. # - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
  50. # - github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
  51. #
  52. # Container images used:
  53. # - ghcr.io/github/gh-aw-firewall/agent:0.29.0@sha256:b14bd399376180b5649a9324be3b50fbfc82bfe8f0c80045840416b5a4e65b96
  54. # - ghcr.io/github/gh-aw-firewall/api-proxy:0.29.0@sha256:baff00b856a4bdc93bce134928c70af3d3492f2e518757115042040674d56b0b
  55. # - ghcr.io/github/gh-aw-firewall/squid:0.29.0@sha256:6e0cbf7f980beb78b5461563a8164f6439ca959bc93733d5a6b52972e523ed50
  56. # - ghcr.io/github/gh-aw-mcpg:v0.5.0@sha256:d3544a4222e7efeeeb38669d8a1af0c72691c55b8f6506b15aa5920f7f31b7bc
  57. # - ghcr.io/github/gh-aw-node@sha256:2c2ea524e648b91c8333ce246e3838fcf5b19ac70e45baac1a51b9207299749f
  58. # - ghcr.io/github/github-mcp-server:v2.0.3@sha256:250bc6ce70788207608ef74cef4397230ff2e8481218da74d6093e4bd9101132
  59. name: "Issue Triage"
  60. on:
  61. issues:
  62. types:
  63. - opened
  64. - reopened
  65. # roles: all # Roles processed as role check in pre-activation job
  66. workflow_dispatch:
  67. inputs:
  68. aw_context:
  69. default: ""
  70. description: "Agent caller context (Reserved for Agentic Workflows)."
  71. required: false
  72. type: string
  73. issue_number:
  74. description: 要分类的 issue 编号
  75. required: true
  76. type: string
  77. # Jobs receive only their explicitly declared permissions.
  78. permissions: {}
  79. concurrency:
  80. group: "gh-aw-${{ github.workflow }}-${{ github.event.issue.number || github.run_id }}"
  81. queue: max
  82. run-name: "Issue Triage"
  83. env:
  84. OTEL_EXPORTER_OTLP_ENDPOINT: ${{ secrets.GH_AW_DEFAULT_OTLP_ENDPOINT || vars.GH_AW_DEFAULT_OTLP_ENDPOINT }}
  85. OTEL_SERVICE_NAME: gh-aw.issue-triage
  86. 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'
  87. OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.GH_AW_DEFAULT_OTLP_HEADERS }}
  88. GH_AW_OTLP_ENDPOINTS: '[{"url":"${{ secrets.GH_AW_DEFAULT_OTLP_ENDPOINT || vars.GH_AW_DEFAULT_OTLP_ENDPOINT }}","headers":"${{ secrets.GH_AW_DEFAULT_OTLP_HEADERS }}"}]'
  89. GH_AW_OTLP_IF_MISSING: ignore
  90. jobs:
  91. activation:
  92. name: activation
  93. runs-on: ubuntu-slim
  94. # Permissions for the activation job (workflow permissions default to none).
  95. permissions:
  96. actions: read
  97. contents: read
  98. issues: write
  99. env:
  100. GH_AW_MAX_DAILY_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_DAILY_AI_CREDITS || '5000' }}
  101. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  102. outputs:
  103. aw_context: ${{ steps.generate_aw_info.outputs.aw_context }}
  104. body: ${{ steps.sanitized.outputs.body }}
  105. comment_id: ""
  106. comment_repo: ""
  107. daily_ai_credits_estimated: ${{ steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_estimated || '' }}
  108. daily_ai_credits_exceeded: ${{ steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_exceeded == 'true' }}
  109. daily_ai_credits_guardrail_error: ${{ steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_error || '' }}
  110. daily_ai_credits_guardrail_status: ${{ steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status || '' }}
  111. daily_ai_credits_threshold: ${{ steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_threshold || '' }}
  112. daily_ai_credits_total: ${{ steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_total || '' }}
  113. engine_id: ${{ steps.generate_aw_info.outputs.engine_id }}
  114. lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }}
  115. model: ${{ steps.generate_aw_info.outputs.model }}
  116. oauth_token_check_failed: ${{ steps.check-oauth-tokens.outputs.oauth_token_check_failed == 'true' }}
  117. secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }}
  118. setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }}
  119. setup-span-id: ${{ steps.setup.outputs.span-id }}
  120. setup-trace-id: ${{ steps.setup.outputs.trace-id }}
  121. stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }}
  122. text: ${{ steps.sanitized.outputs.text }}
  123. title: ${{ steps.sanitized.outputs.title }}
  124. steps:
  125. - name: Setup Scripts
  126. id: setup
  127. uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
  128. with:
  129. destination: ${{ runner.temp }}/gh-aw/actions
  130. job-name: ${{ github.job }}
  131. safe-output-artifact-client: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
  132. env:
  133. GH_AW_SETUP_WORKFLOW_NAME: "Issue Triage"
  134. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-triage.lock.yml@${{ github.ref }}
  135. GH_AW_INFO_VERSION: "0.164.0"
  136. GH_AW_INFO_AWF_VERSION: "v0.29.0"
  137. GH_AW_INFO_ENGINE_ID: "codex"
  138. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  139. - name: Mask OTLP telemetry headers
  140. run: bash "${RUNNER_TEMP}/gh-aw/actions/mask_otlp_headers.sh"
  141. - name: Generate agentic run info
  142. id: generate_aw_info
  143. env:
  144. GH_AW_INFO_ENGINE_ID: "codex"
  145. GH_AW_INFO_ENGINE_NAME: "Codex"
  146. GH_AW_INFO_MODEL: "gpt-5.6-luna"
  147. GH_AW_INFO_VERSION: "0.164.0"
  148. GH_AW_INFO_AGENT_VERSION: "0.164.0"
  149. GH_AW_INFO_CLI_VERSION: "v1.0.1"
  150. GH_AW_INFO_WORKFLOW_NAME: "Issue Triage"
  151. GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
  152. GH_AW_INFO_EXPERIMENTAL: "false"
  153. GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true"
  154. GH_AW_INFO_STAGED: "false"
  155. 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"]'
  156. GH_AW_INFO_FIREWALL_ENABLED: "true"
  157. GH_AW_INFO_AWF_VERSION: "v0.29.0"
  158. GH_AW_INFO_AWMG_VERSION: ""
  159. GH_AW_INFO_FIREWALL_TYPE: "squid"
  160. GH_AW_INFO_AGENT_RUNTIME: ""
  161. GH_AW_INFO_MODEL_CONFIG: '{"routing":{"enabled":false},"models":{"allowed":[],"blocked":[]},"max_ai_credits_source":"default"}'
  162. GH_AW_INFO_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }}
  163. GH_AW_COMPILED_STRICT: "true"
  164. GH_AW_INFO_MODEL_COSTS: '{"providers":{"openai":{"models":{"gpt-5.6-luna":{"cost":{"cache_read":"2e-08","cache_write":"2.5e-07","input":"2e-07","output":"1.2e-06"}}}}}}'
  165. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  166. with:
  167. script: |
  168. const path = require('path');
  169. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  170. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  171. setupGlobals(core, github, context, exec, io, getOctokit);
  172. const { main } = require(path.join(actionsDir, 'generate_aw_info.cjs'));
  173. await main(core, context);
  174. - name: Restore daily AIC scan observations
  175. id: restore-daily-aic-cache-fallback
  176. if: ${{ env.GH_AW_ADMISSION_RESULT != 'admitted' && env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
  177. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  178. env:
  179. GH_AW_HAS_SLASH_COMMAND: "false"
  180. GH_AW_HAS_LABEL_COMMAND: "false"
  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_scan_cache.cjs'));
  189. await main();
  190. - name: Check daily workflow token guardrail
  191. id: daily-ai-credits-workflow-guardrail
  192. if: ${{ env.GH_AW_ADMISSION_RESULT != 'admitted' && 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. GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }}
  204. with:
  205. github-token: ${{ secrets.GITHUB_TOKEN }}
  206. script: |
  207. const path = require('path');
  208. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  209. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  210. setupGlobals(core, github, context, exec, io, getOctokit);
  211. const { main } = require(path.join(actionsDir, 'check_daily_aic_workflow_guardrail.cjs'));
  212. await main();
  213. - name: Publish daily AIC scan observations
  214. if: always() && env.GH_AW_ADMISSION_RESULT != 'admitted' && env.GH_AW_MAX_DAILY_AI_CREDITS != ''
  215. continue-on-error: true
  216. uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
  217. with:
  218. name: aic-usage-scan-v2
  219. path: /tmp/gh-aw/agentic-workflow-usage-scan-v2.jsonl
  220. overwrite: true
  221. if-no-files-found: ignore
  222. retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '3' }}
  223. - name: Validate CODEX_API_KEY or OPENAI_API_KEY secret
  224. id: validate-secret
  225. 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
  226. env:
  227. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  228. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  229. - name: Check for OAuth tokens
  230. id: check-oauth-tokens
  231. run: bash "${RUNNER_TEMP}/gh-aw/actions/check_oauth_tokens.sh"
  232. env:
  233. COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
  234. GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  235. GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  236. - name: Checkout .github and .agents folders
  237. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  238. with:
  239. persist-credentials: false
  240. sparse-checkout: |
  241. .github
  242. .agents
  243. .claude
  244. .codex
  245. .gemini
  246. .pi
  247. sparse-checkout-cone-mode: true
  248. fetch-depth: 1
  249. - name: Save agent config folders for base branch restoration
  250. env:
  251. GH_AW_AGENT_FOLDERS: ".agents .codex .github"
  252. GH_AW_AGENT_FILES: "AGENTS.md"
  253. run: |
  254. bash "${RUNNER_TEMP}/gh-aw/actions/save_base_github_folders.sh"
  255. - name: Check workflow lock file
  256. id: check-lock-file
  257. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  258. env:
  259. GH_AW_WORKFLOW_FILE: "issue-triage.lock.yml"
  260. GH_AW_CONTEXT_WORKFLOW_REF: "${{ github.workflow_ref }}"
  261. with:
  262. script: |
  263. const path = require('path');
  264. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  265. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  266. setupGlobals(core, github, context, exec, io, getOctokit);
  267. const { main } = require(path.join(actionsDir, 'check_workflow_timestamp_api.cjs'));
  268. await main();
  269. - name: Check compile-agentic version
  270. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  271. env:
  272. GH_AW_COMPILED_VERSION: "v1.0.1"
  273. GH_AW_HAS_SAFE_OUTPUTS: "true"
  274. GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "true"
  275. GH_AW_WORKFLOW_NAME: "Issue Triage"
  276. with:
  277. script: |
  278. const path = require('path');
  279. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  280. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  281. setupGlobals(core, github, context, exec, io, getOctokit);
  282. const { main } = require(path.join(actionsDir, 'check_version_updates.cjs'));
  283. await main();
  284. - name: Compute current body text
  285. id: sanitized
  286. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  287. env:
  288. 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"
  289. with:
  290. script: |
  291. const path = require('path');
  292. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  293. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  294. setupGlobals(core, github, context, exec, io, getOctokit);
  295. const { main } = require(path.join(actionsDir, 'compute_text.cjs'));
  296. await main();
  297. - name: Log runtime features
  298. if: ${{ contains(toJSON(vars), '"GH_AW_RUNTIME_FEATURES":') }}
  299. run: bash "${RUNNER_TEMP}/gh-aw/actions/log_runtime_features_summary.sh"
  300. - name: Create prompt with built-in context
  301. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  302. env:
  303. GH_AW_ACTIONS_DIR: ${{ runner.temp }}/gh-aw/actions
  304. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  305. GH_AW_SAFE_OUTPUTS: ${{ runner.temp }}/gh-aw/safeoutputs/outputs.jsonl
  306. 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_mcp_transport_prompt.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\"}],\"system_item_count\":12}"
  307. GH_AW_EXPR_54492A5B: ${{ github.event.issue.number || inputs.issue_number }}
  308. GH_AW_EXPR_76DF9333: ${{ github.event.pull_request.number || (fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_type == 'pull_request' && fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_number) }}
  309. GH_AW_EXPR_77C1A4D2: ${{ github.event.comment.id || fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').comment_id }}
  310. GH_AW_EXPR_7C248226: ${{ github.event.issue.number || (fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_type == 'issue' && fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_number) }}
  311. GH_AW_EXPR_C19C384F: ${{ github.event.discussion.number || (fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_type == 'discussion' && fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_number) }}
  312. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  313. GH_AW_GITHUB_EVENT_ISSUE_TITLE: ${{ github.event.issue.title }}
  314. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  315. GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
  316. GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
  317. GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }}
  318. GH_AW_PROMPT_CONTENT_0000: "<system>\n"
  319. GH_AW_PROMPT_CONTENT_0001: "<safe-output-tools>\nTools: add_comment, add_labels(max:2), issue_handle_bug, issue_handle_enhancement, issue_handle_question, issue_handle_other, report_missing_tool, report_missing_data, noop(max:2)\nShared budgets: call-workflow [issue_handle_bug, issue_handle_enhancement, issue_handle_question, issue_handle_other](max:1 total)\n"
  320. GH_AW_PROMPT_CONTENT_0002: "</safe-output-tools>\n"
  321. GH_AW_PROMPT_CONTENT_0003: "<github-context>\nThe following GitHub context information is available for this workflow:\n{{#if github.actor}}\n- **actor**: __GH_AW_GITHUB_ACTOR__\n{{/if}}\n{{#if github.repository}}\n- **repository**: __GH_AW_GITHUB_REPOSITORY__\n{{/if}}\n{{#if github.workspace}}\n- **workspace**: __GH_AW_GITHUB_WORKSPACE__\n{{/if}}\n{{#if github.event.issue.number || (github.aw.context.item_type == 'issue' && github.aw.context.item_number)}}\n- **issue-number**: #__GH_AW_EXPR_7C248226__\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_C19C384F__\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_76DF9333__\n{{/if}}\n{{#if github.event.comment.id || github.aw.context.comment_id}}\n- **comment-id**: __GH_AW_EXPR_77C1A4D2__\n{{/if}}\n{{#if github.run_id}}\n- **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__\n{{/if}}\n</github-context>\n\n"
  322. GH_AW_PROMPT_CONTENT_0004: "</system>\n"
  323. GH_AW_PROMPT_CONTENT_0005: "{{#runtime-import .github/workflows/shared/engine.md}}\n"
  324. GH_AW_PROMPT_CONTENT_0006: "{{#runtime-import .github/workflows/shared/network.md}}\n"
  325. GH_AW_PROMPT_CONTENT_0007: "{{#runtime-import .github/workflows/issue-triage.md}}\n"
  326. with:
  327. script: |
  328. const { setupGlobals } = require(process.env.GH_AW_ACTIONS_DIR + '/setup_globals.cjs');
  329. setupGlobals(core, github, context, exec, io, getOctokit);
  330. const { main } = require(process.env.GH_AW_ACTIONS_DIR + '/create_prompt.cjs');
  331. await main(core);
  332. - name: Interpolate variables and render templates
  333. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  334. env:
  335. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  336. GH_AW_ENGINE_ID: "codex"
  337. GH_AW_SUB_AGENT_DIR: ".codex/agents"
  338. GH_AW_SUB_AGENT_EXT: ".md"
  339. GH_AW_SKILL_DIR: ".codex/skills"
  340. GH_AW_SKILL_EXT: "/SKILL.md"
  341. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  342. GH_AW_EXPR_54492A5B: ${{ github.event.issue.number || inputs.issue_number }}
  343. GH_AW_GITHUB_EVENT_ISSUE_TITLE: ${{ github.event.issue.title }}
  344. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  345. GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }}
  346. with:
  347. script: |
  348. const path = require('path');
  349. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  350. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  351. setupGlobals(core, github, context, exec, io, getOctokit);
  352. const { main } = require(path.join(actionsDir, 'interpolate_prompt.cjs'));
  353. await main();
  354. - name: Substitute placeholders
  355. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  356. env:
  357. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  358. GH_AW_EXPR_54492A5B: ${{ github.event.issue.number || inputs.issue_number }}
  359. GH_AW_EXPR_76DF9333: ${{ github.event.pull_request.number || (fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_type == 'pull_request' && fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_number) }}
  360. GH_AW_EXPR_77C1A4D2: ${{ github.event.comment.id || fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').comment_id }}
  361. GH_AW_EXPR_7C248226: ${{ github.event.issue.number || (fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_type == 'issue' && fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_number) }}
  362. GH_AW_EXPR_C19C384F: ${{ github.event.discussion.number || (fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_type == 'discussion' && fromJSON(steps.generate_aw_info.outputs.aw_context || '{}').item_number) }}
  363. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  364. GH_AW_GITHUB_EVENT_ISSUE_TITLE: ${{ github.event.issue.title }}
  365. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  366. GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
  367. GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
  368. GH_AW_INPUTS_ISSUE_NUMBER: ${{ inputs.issue_number }}
  369. GH_AW_MCP_CLI_SERVERS_LIST: '- `safeoutputs` — run `safeoutputs --help` to see available tools'
  370. with:
  371. script: |
  372. const path = require('path');
  373. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  374. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  375. setupGlobals(core, github, context, exec, io, getOctokit);
  376. const substitutePlaceholders = require(path.join(actionsDir, 'substitute_placeholders.cjs'));
  377. // Call the substitution function
  378. return await substitutePlaceholders({
  379. file: process.env.GH_AW_PROMPT,
  380. substitutions: {
  381. GH_AW_EXPR_54492A5B: process.env.GH_AW_EXPR_54492A5B,
  382. GH_AW_EXPR_76DF9333: process.env.GH_AW_EXPR_76DF9333,
  383. GH_AW_EXPR_77C1A4D2: process.env.GH_AW_EXPR_77C1A4D2,
  384. GH_AW_EXPR_7C248226: process.env.GH_AW_EXPR_7C248226,
  385. GH_AW_EXPR_C19C384F: process.env.GH_AW_EXPR_C19C384F,
  386. GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR,
  387. GH_AW_GITHUB_EVENT_ISSUE_TITLE: process.env.GH_AW_GITHUB_EVENT_ISSUE_TITLE,
  388. GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY,
  389. GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID,
  390. GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE,
  391. GH_AW_INPUTS_ISSUE_NUMBER: process.env.GH_AW_INPUTS_ISSUE_NUMBER,
  392. GH_AW_MCP_CLI_SERVERS_LIST: process.env.GH_AW_MCP_CLI_SERVERS_LIST
  393. }
  394. });
  395. - name: Validate prompt placeholders
  396. env:
  397. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  398. run: |
  399. bash "${RUNNER_TEMP}/gh-aw/actions/validate_prompt_placeholders.sh"
  400. - name: Print prompt
  401. env:
  402. GH_AW_PROMPT: ${{ runner.temp }}/gh-aw/aw-prompts/prompt.txt
  403. run: |
  404. bash "${RUNNER_TEMP}/gh-aw/actions/print_prompt_summary.sh"
  405. - name: Inventory installed skills
  406. if: success() || failure()
  407. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  408. env:
  409. GH_AW_SKILL_DIR: ".codex/skills"
  410. with:
  411. script: |
  412. const path = require('path');
  413. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  414. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  415. setupGlobals(core, github, context, exec, io, getOctokit);
  416. const { main } = require(path.join(actionsDir, 'skill_inventory.cjs'));
  417. await main();
  418. - name: Upload info artifact
  419. if: success() || failure()
  420. uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
  421. with:
  422. name: info
  423. path: /tmp/gh-aw/aw_info.json
  424. if-no-files-found: ignore
  425. retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
  426. - name: Stage prompt files for artifact upload
  427. run: |
  428. mkdir -p /tmp/gh-aw/aw-prompts
  429. cp -a "${RUNNER_TEMP}/gh-aw/aw-prompts/." /tmp/gh-aw/aw-prompts/
  430. - name: Upload activation artifact
  431. if: success() || failure()
  432. uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
  433. with:
  434. name: activation
  435. include-hidden-files: true
  436. path: |
  437. /tmp/gh-aw/aw_info.json
  438. /tmp/gh-aw/models.json
  439. /tmp/gh-aw/aw-prompts/prompt.txt
  440. /tmp/gh-aw/aw-prompts/system.txt
  441. /tmp/gh-aw/aw-prompts/user.txt
  442. /tmp/gh-aw/aw-prompts/prompt-template.txt
  443. /tmp/gh-aw/aw-prompts/prompt-import-tree.json
  444. /tmp/gh-aw/github_rate_limits.jsonl
  445. /tmp/gh-aw/base
  446. /tmp/gh-aw/.codex/agents
  447. /tmp/gh-aw/.codex/skills
  448. /tmp/gh-aw/skill_inventory.json
  449. if-no-files-found: ignore
  450. retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '1' }}
  451. agent:
  452. name: agent
  453. needs: activation
  454. if: needs.activation.outputs.daily_ai_credits_exceeded != 'true'
  455. runs-on: ubuntu-latest
  456. # Permissions for the agent job (workflow permissions default to none).
  457. permissions:
  458. actions: read
  459. checks: read
  460. contents: read
  461. discussions: read
  462. issues: read
  463. pull-requests: read
  464. statuses: read
  465. timeout-minutes: 60
  466. env:
  467. DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
  468. GH_AW_ASSETS_ALLOWED_EXTS: ""
  469. GH_AW_ASSETS_BRANCH: ""
  470. GH_AW_ASSETS_MAX_SIZE_KB: 0
  471. GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs
  472. GH_AW_PR_HEAD_BASE_BRANCH: ""
  473. GH_AW_PR_HEAD_BASE_PR_NUMBER: ""
  474. GH_AW_PR_HEAD_BASE_REF: ""
  475. GH_AW_PR_HEAD_BASE_REPO: ""
  476. GH_AW_PR_HEAD_BASE_SHA: ""
  477. GH_AW_PR_HEAD_REPO: ""
  478. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  479. GH_AW_TARGET_REPO_SLUG: ""
  480. GH_AW_WORKFLOW_ID_SANITIZED: issuetriage
  481. outputs:
  482. agentic_engine_timeout: ${{ steps.detect-agent-errors.outputs.agentic_engine_timeout || 'false' }}
  483. ai_credits_rate_limit_error: ${{ steps.parse-mcp-gateway.outputs.ai_credits_rate_limit_error || 'false' }}
  484. aic: ${{ steps.parse-token-usage.outputs.aic }}
  485. ambient_context: ${{ steps.parse-token-usage.outputs.ambient_context }}
  486. checkout_pr_invalidated: ${{ steps.checkout-pr.outputs.checkout_pr_invalidated || 'false' }}
  487. checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }}
  488. has_patch: ${{ steps.collect_output.outputs.has_patch }}
  489. http_400_response_error: ${{ steps.detect-agent-errors.outputs.http_400_response_error || 'false' }}
  490. inference_access_error: ${{ steps.detect-agent-errors.outputs.inference_access_error || 'false' }}
  491. invocation_cap_exceeded: ${{ steps.detect-agent-errors.outputs.invocation_cap_exceeded || 'false' }}
  492. max_cache_misses_exceeded: ${{ steps.detect-agent-errors.outputs.max_cache_misses_exceeded || 'false' }}
  493. mcp_policy_error: ${{ steps.detect-agent-errors.outputs.mcp_policy_error || 'false' }}
  494. missing_model_pricing_error: ${{ steps.detect-agent-errors.outputs.missing_model_pricing_error || 'false' }}
  495. missing_model_pricing_model_name: ${{ steps.detect-agent-errors.outputs.missing_model_pricing_model_name || '' }}
  496. model: ${{ needs.activation.outputs.model }}
  497. model_endpoint_mismatch_error: ${{ steps.detect-agent-errors.outputs.model_endpoint_mismatch_error || 'false' }}
  498. model_not_supported_error: ${{ steps.detect-agent-errors.outputs.model_not_supported_error || 'false' }}
  499. output: ${{ steps.collect_output.outputs.output }}
  500. output_types: ${{ steps.collect_output.outputs.output_types }}
  501. setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }}
  502. setup-span-id: ${{ steps.setup.outputs.span-id }}
  503. setup-trace-id: ${{ steps.setup.outputs.trace-id }}
  504. shell_expansion_guard_rejected: ${{ steps.detect-agent-errors.outputs.shell_expansion_guard_rejected || 'false' }}
  505. unknown_model_ai_credits: ${{ steps.parse-mcp-gateway.outputs.unknown_model_ai_credits || 'false' }}
  506. steps:
  507. - name: Setup Scripts
  508. id: setup
  509. uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
  510. with:
  511. destination: ${{ runner.temp }}/gh-aw/actions
  512. job-name: ${{ github.job }}
  513. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  514. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  515. env:
  516. GH_AW_SETUP_WORKFLOW_NAME: "Issue Triage"
  517. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-triage.lock.yml@${{ github.ref }}
  518. GH_AW_INFO_VERSION: "0.164.0"
  519. GH_AW_INFO_AWF_VERSION: "v0.29.0"
  520. GH_AW_INFO_ENGINE_ID: "codex"
  521. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  522. - name: Set runtime paths
  523. id: set-runtime-paths
  524. env:
  525. GH_AW_RUNNER_TOOL_CACHE: ${{ runner.tool_cache }}
  526. run: | # zizmor: ignore[github-env] - runner.tool_cache is set by GitHub Actions, not user input.
  527. if [ -z "${RUNNER_TOOL_CACHE:-}" ]; then
  528. echo "RUNNER_TOOL_CACHE=${GH_AW_RUNNER_TOOL_CACHE}" >> "$GITHUB_ENV"
  529. fi
  530. {
  531. echo "GH_AW_SAFE_OUTPUTS=${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl"
  532. echo "GH_AW_SAFE_OUTPUTS_CONFIG_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/config.json"
  533. echo "GH_AW_SAFE_OUTPUTS_TOOLS_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/tools.json"
  534. } >> "$GITHUB_OUTPUT"
  535. - name: Mask OTLP telemetry headers
  536. run: bash "${RUNNER_TEMP}/gh-aw/actions/mask_otlp_headers.sh"
  537. - name: Check OTLP telemetry configuration
  538. run: bash "${RUNNER_TEMP}/gh-aw/actions/check_otlp_default_credentials.sh"
  539. - name: Checkout repository (gh-aw default)
  540. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  541. with:
  542. persist-credentials: false
  543. - name: Initialize agent execution evidence
  544. run: |
  545. mkdir -p "/tmp/gh-aw"
  546. evidence_tmp="/tmp/gh-aw/agent_execution.json.tmp"
  547. printf '{"version":1,"component":"agent","run_id":%s,"run_attempt":%s,"state":"not_started"}\n' "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" > "$evidence_tmp"
  548. mv "$evidence_tmp" "/tmp/gh-aw/agent_execution.json"
  549. - name: Create gh-aw temp directory
  550. run: bash "${RUNNER_TEMP}/gh-aw/actions/create_gh_aw_tmp_dir.sh"
  551. - name: Configure gh CLI for GitHub Enterprise
  552. run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_gh_for_ghe.sh"
  553. env:
  554. GH_TOKEN: ${{ github.token }}
  555. - name: Download activation artifact
  556. uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
  557. with:
  558. name: activation
  559. path: /tmp/gh-aw
  560. - name: Configure Git credentials
  561. env:
  562. GITHUB_REPOSITORY: ${{ github.repository }}
  563. GITHUB_SERVER_URL: ${{ github.server_url }}
  564. GITHUB_TOKEN: ${{ github.token }}
  565. run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh"
  566. - name: Checkout PR branch
  567. id: checkout-pr
  568. if: |
  569. github.event.pull_request || github.event.issue.pull_request || github.event_name == 'workflow_dispatch'
  570. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  571. env:
  572. GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  573. with:
  574. github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  575. script: |
  576. const path = require('path');
  577. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  578. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  579. setupGlobals(core, github, context, exec, io, getOctokit);
  580. const { main } = require(path.join(actionsDir, 'checkout_pr_branch.cjs'));
  581. await main();
  582. - name: Setup Node.js
  583. uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
  584. with:
  585. node-version: '24'
  586. package-manager-cache: false
  587. - name: Install Codex CLI
  588. run: npm install --ignore-scripts -g @openai/codex@0.164.0
  589. - name: Install AWF binary
  590. run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.0 --rootless
  591. - name: Determine automatic lockdown mode for GitHub MCP Server
  592. id: determine-automatic-lockdown
  593. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  594. env:
  595. GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  596. GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  597. GH_AW_GITHUB_MIN_INTEGRITY: 'none'
  598. with:
  599. script: |
  600. const path = require('path');
  601. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  602. const determineAutomaticLockdown = require(path.join(actionsDir, 'determine_automatic_lockdown.cjs'));
  603. await determineAutomaticLockdown(github, context, core);
  604. - name: Parse integrity filter lists
  605. id: parse-guard-vars
  606. env:
  607. GH_AW_BLOCKED_USERS_VAR: ${{ vars.GH_AW_GITHUB_BLOCKED_USERS || '' }}
  608. GH_AW_TRUSTED_USERS_VAR: ${{ vars.GH_AW_GITHUB_TRUSTED_USERS || '' }}
  609. GH_AW_APPROVAL_LABELS_VAR: ${{ vars.GH_AW_GITHUB_APPROVAL_LABELS || '' }}
  610. run: bash "${RUNNER_TEMP}/gh-aw/actions/parse_guard_list.sh"
  611. - name: Restore agent config folders from base branch
  612. if: steps.checkout-pr.outcome == 'success'
  613. env:
  614. GH_AW_AGENT_FOLDERS: ".agents .codex .github"
  615. GH_AW_AGENT_FILES: "AGENTS.md"
  616. run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_base_github_folders.sh"
  617. - name: Restore inline sub-agents from activation artifact
  618. env:
  619. GH_AW_SUB_AGENT_DIR: ".codex/agents"
  620. GH_AW_SUB_AGENT_EXT: ".md"
  621. run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_sub_agents.sh"
  622. - name: Restore inline skills from activation artifact
  623. env:
  624. GH_AW_SKILL_DIR: ".codex/skills"
  625. run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_skills.sh"
  626. - name: Download container images
  627. run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.29.0@sha256:b14bd399376180b5649a9324be3b50fbfc82bfe8f0c80045840416b5a4e65b96 ghcr.io/github/gh-aw-firewall/api-proxy:0.29.0@sha256:baff00b856a4bdc93bce134928c70af3d3492f2e518757115042040674d56b0b ghcr.io/github/gh-aw-firewall/squid:0.29.0@sha256:6e0cbf7f980beb78b5461563a8164f6439ca959bc93733d5a6b52972e523ed50 ghcr.io/github/gh-aw-mcpg:v0.5.0@sha256:d3544a4222e7efeeeb38669d8a1af0c72691c55b8f6506b15aa5920f7f31b7bc ghcr.io/github/gh-aw-node@sha256:2c2ea524e648b91c8333ce246e3838fcf5b19ac70e45baac1a51b9207299749f ghcr.io/github/github-mcp-server:v2.0.3@sha256:250bc6ce70788207608ef74cef4397230ff2e8481218da74d6093e4bd9101132
  628. - name: Configure Codex
  629. run: |
  630. "$(command -v node)" "${RUNNER_TEMP}/gh-aw/actions/convert_gateway_config_codex.cjs" --bootstrap
  631. env:
  632. CODEX_HOME: /tmp/gh-aw/mcp-config
  633. GH_AW_CODEX_CONFIG_JSON: '{"defaults":{"features":{"plugins":false},"history":{"persistence":"none"},"mcp_servers":{"github":{"http_headers":{"User-Agent":"issue-triage"},"startup_timeout_sec":120,"tool_timeout_sec":60},"safeoutputs":{"startup_timeout_sec":120,"tool_timeout_sec":60}},"model_provider":"openai-proxy","model_providers":{"openai-proxy":{"base_url":"http://172.30.0.30:10000","env_key":"CODEX_API_KEY","name":"OpenAI AWF proxy","requires_openai_auth":false,"supports_websockets":false,"wire_api":"responses"}},"otel":{"metrics_exporter":"none"},"shell_environment_policy":{"ignore_default_excludes":false,"include_only":["ALL_PROXY","CURL_CA_BUNDLE","GITHUB_WORKSPACE","GIT_AUTHOR_EMAIL","GIT_AUTHOR_NAME","GIT_COMMITTER_EMAIL","GIT_COMMITTER_NAME","HOME","HTTPS_PROXY","HTTP_PROXY","LANG","LC_ALL","LC_CTYPE","LOGNAME","NODE_EXTRA_CA_CERTS","NO_PROXY","OPENAI_BASE_URL","PATH","PLAYWRIGHT_BROWSERS_PATH","REQUESTS_CA_BUNDLE","RUNNER_TEMP","RUNNER_TOOL_CACHE","SHELL","SSL_CERT_DIR","SSL_CERT_FILE","TEMP","TMP","TMPDIR","USER","all_proxy","http_proxy","https_proxy","no_proxy"],"inherit":"all"}},"overrides":{},"disablePlugins":true}'
  634. - name: Prepare Safe Outputs Directories
  635. run: |
  636. mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs"
  637. mkdir -p /tmp/gh-aw/safeoutputs
  638. mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs
  639. - name: Generate Safe Outputs Config
  640. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  641. env:
  642. GH_AW_FILE_ROOT: "${{ runner.temp }}/gh-aw"
  643. GH_AW_FILE_CONFIG: "{\"files\":[{\"path\":\"safeoutputs/config.json\",\"content_env\":\"GH_AW_SAFE_OUTPUTS_CONFIG\"}]}"
  644. 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\":{},\"noop\":{\"max\":2,\"report-as-issue\":\"false\"},\"report_incomplete\":{},\"report_missing_data\":{},\"report_missing_tool\":{}}"
  645. with:
  646. script: |
  647. const path = require('path');
  648. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  649. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  650. setupGlobals(core, github, context, exec, io, getOctokit);
  651. const { main } = require(path.join(actionsDir, 'create_files.cjs'));
  652. await main();
  653. - name: Generate Safe Outputs Tools
  654. env:
  655. GH_AW_TOOLS_META_JSON: |
  656. {
  657. "description_suffixes": {
  658. "add_comment": " CONSTRAINTS: Maximum 1 comment(s) can be added. Target: triggering. Supports reply_to_id for discussion threading.",
  659. "add_labels": " CONSTRAINTS: Maximum 2 add_labels call(s) allowed. Maximum 10 label(s) per call. Only these labels are allowed: [\"bug\" \"enhancement\" \"question\" \"other\"]. Target: triggering."
  660. },
  661. "repo_params": {},
  662. "dynamic_tools": [
  663. {
  664. "_call_workflow_name": "issue-handle-bug",
  665. "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.",
  666. "inputSchema": {
  667. "additionalProperties": false,
  668. "properties": {
  669. "aw_context": {
  670. "default": "",
  671. "description": "Agent caller context (Reserved for Agentic Workflows).",
  672. "type": "string"
  673. },
  674. "issue_number": {
  675. "description": "Input parameter 'issue_number' for workflow issue-handle-bug",
  676. "type": "string"
  677. },
  678. "payload": {
  679. "description": "Input parameter 'payload' for workflow issue-handle-bug",
  680. "type": "string"
  681. }
  682. },
  683. "required": [
  684. "issue_number"
  685. ],
  686. "type": "object"
  687. },
  688. "name": "issue_handle_bug"
  689. },
  690. {
  691. "_call_workflow_name": "issue-handle-enhancement",
  692. "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.",
  693. "inputSchema": {
  694. "additionalProperties": false,
  695. "properties": {
  696. "aw_context": {
  697. "default": "",
  698. "description": "Agent caller context (Reserved for Agentic Workflows).",
  699. "type": "string"
  700. },
  701. "issue_number": {
  702. "description": "Input parameter 'issue_number' for workflow issue-handle-enhancement",
  703. "type": "string"
  704. },
  705. "payload": {
  706. "description": "Input parameter 'payload' for workflow issue-handle-enhancement",
  707. "type": "string"
  708. }
  709. },
  710. "required": [
  711. "issue_number"
  712. ],
  713. "type": "object"
  714. },
  715. "name": "issue_handle_enhancement"
  716. },
  717. {
  718. "_call_workflow_name": "issue-handle-question",
  719. "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.",
  720. "inputSchema": {
  721. "additionalProperties": false,
  722. "properties": {
  723. "aw_context": {
  724. "default": "",
  725. "description": "Agent caller context (Reserved for Agentic Workflows).",
  726. "type": "string"
  727. },
  728. "issue_number": {
  729. "description": "Input parameter 'issue_number' for workflow issue-handle-question",
  730. "type": "string"
  731. },
  732. "payload": {
  733. "description": "Input parameter 'payload' for workflow issue-handle-question",
  734. "type": "string"
  735. }
  736. },
  737. "required": [
  738. "issue_number"
  739. ],
  740. "type": "object"
  741. },
  742. "name": "issue_handle_question"
  743. },
  744. {
  745. "_call_workflow_name": "issue-handle-other",
  746. "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.",
  747. "inputSchema": {
  748. "additionalProperties": false,
  749. "properties": {
  750. "aw_context": {
  751. "default": "",
  752. "description": "Agent caller context (Reserved for Agentic Workflows).",
  753. "type": "string"
  754. },
  755. "issue_number": {
  756. "description": "Input parameter 'issue_number' for workflow issue-handle-other",
  757. "type": "string"
  758. },
  759. "payload": {
  760. "description": "Input parameter 'payload' for workflow issue-handle-other",
  761. "type": "string"
  762. }
  763. },
  764. "required": [
  765. "issue_number"
  766. ],
  767. "type": "object"
  768. },
  769. "name": "issue_handle_other"
  770. }
  771. ]
  772. }
  773. GH_AW_VALIDATION_JSON: |
  774. {
  775. "add_comment": {
  776. "defaultMax": 1,
  777. "fields": {
  778. "body": {
  779. "required": true,
  780. "type": "string",
  781. "sanitize": true,
  782. "maxLength": 65000
  783. },
  784. "comment_id": {
  785. "optionalPositiveInteger": true
  786. },
  787. "item_number": {
  788. "issueOrPRNumber": true
  789. },
  790. "pr": {
  791. "issueOrPRNumber": true
  792. },
  793. "pr_number": {
  794. "issueOrPRNumber": true
  795. },
  796. "reply_to_id": {
  797. "type": "string",
  798. "maxLength": 256
  799. },
  800. "repo": {
  801. "type": "string",
  802. "maxLength": 256
  803. },
  804. "target": {
  805. "type": "string",
  806. "enum": [
  807. "status"
  808. ]
  809. },
  810. "temporary_id": {
  811. "type": "string",
  812. "pattern": "^#?aw_[A-Za-z0-9_]{3,12}$"
  813. }
  814. }
  815. },
  816. "add_labels": {
  817. "defaultMax": 5,
  818. "fields": {
  819. "item_number": {
  820. "issueNumberOrTemporaryId": true
  821. },
  822. "labels": {
  823. "required": true,
  824. "type": "array"
  825. },
  826. "repo": {
  827. "type": "string",
  828. "maxLength": 256
  829. }
  830. }
  831. },
  832. "call_workflow": {
  833. "defaultMax": 1,
  834. "fields": {
  835. "inputs": {
  836. "type": "object"
  837. },
  838. "workflow_name": {
  839. "required": true,
  840. "type": "string",
  841. "sanitize": true,
  842. "maxLength": 256,
  843. "minLength": 1,
  844. "pattern": ".*\\S.*",
  845. "patternError": "must not be empty"
  846. }
  847. }
  848. },
  849. "noop": {
  850. "defaultMax": 2,
  851. "fields": {
  852. "message": {
  853. "required": true,
  854. "type": "string",
  855. "sanitize": true,
  856. "maxLength": 65000
  857. }
  858. }
  859. },
  860. "report_incomplete": {
  861. "defaultMax": 5,
  862. "fields": {
  863. "details": {
  864. "type": "string",
  865. "sanitize": true,
  866. "maxLength": 65000
  867. },
  868. "reason": {
  869. "required": true,
  870. "type": "string",
  871. "sanitize": true,
  872. "maxLength": 1024
  873. }
  874. }
  875. },
  876. "report_missing_data": {
  877. "defaultMax": 20,
  878. "fields": {
  879. "alternatives": {
  880. "type": "string",
  881. "sanitize": true,
  882. "maxLength": 256
  883. },
  884. "context": {
  885. "type": "string",
  886. "sanitize": true,
  887. "maxLength": 256
  888. },
  889. "data_type": {
  890. "type": "string",
  891. "sanitize": true,
  892. "maxLength": 128
  893. },
  894. "reason": {
  895. "type": "string",
  896. "sanitize": true,
  897. "maxLength": 256
  898. }
  899. }
  900. },
  901. "report_missing_tool": {
  902. "defaultMax": 20,
  903. "fields": {
  904. "alternatives": {
  905. "type": "string",
  906. "sanitize": true,
  907. "maxLength": 512
  908. },
  909. "reason": {
  910. "required": true,
  911. "type": "string",
  912. "sanitize": true,
  913. "maxLength": 256
  914. },
  915. "tool": {
  916. "type": "string",
  917. "sanitize": true,
  918. "maxLength": 128
  919. }
  920. }
  921. }
  922. }
  923. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  924. with:
  925. script: |
  926. const path = require('path');
  927. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  928. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  929. setupGlobals(core, github, context, exec, io, getOctokit);
  930. const { main } = require(path.join(actionsDir, 'generate_safe_outputs_tools.cjs'));
  931. await main();
  932. - name: Start MCP Gateway
  933. id: start-mcp-gateway
  934. env:
  935. CODEX_HOME: /tmp/gh-aw/mcp-config
  936. DEBUG: ${{ env.DEBUG || runner.debug == '1' && '*' || '' }}
  937. GH_AW_GUARD_APPROVAL_LABELS: ${{ steps.parse-guard-vars.outputs.approval_labels }}
  938. GH_AW_GUARD_BLOCKED_USERS: ${{ steps.parse-guard-vars.outputs.blocked_users }}
  939. GH_AW_GUARD_TRUSTED_USERS: ${{ steps.parse-guard-vars.outputs.trusted_users }}
  940. GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST: ${{ vars.GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST || 'true' }}
  941. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  942. GH_AW_SAFE_OUTPUTS_CONFIG_PATH: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS_CONFIG_PATH }}
  943. GH_AW_SAFE_OUTPUTS_TOOLS_PATH: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS_TOOLS_PATH }}
  944. GH_AW_SINK_VISIBILITY: ${{ steps.determine-automatic-lockdown.outputs.visibility }}
  945. GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  946. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  947. run: |
  948. set -eo pipefail
  949. mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config"
  950. if [ -n "${GITHUB_EVENT_PATH:-}" ] && [ -r "${GITHUB_EVENT_PATH}" ]; then
  951. GH_AW_SAFEOUTPUTS_EVENT_PATH="${RUNNER_TEMP}/gh-aw/safeoutputs/github_event.json"
  952. cp "${GITHUB_EVENT_PATH}" "${GH_AW_SAFEOUTPUTS_EVENT_PATH}"
  953. export GITHUB_EVENT_PATH="${GH_AW_SAFEOUTPUTS_EVENT_PATH}"
  954. fi
  955. # Export gateway environment variables for MCP config and gateway script
  956. export MCP_GATEWAY_PORT="8080"
  957. export MCP_GATEWAY_DOMAIN="awmg-mcpg"
  958. export MCP_GATEWAY_HOST_DOMAIN="localhost"
  959. MCP_GATEWAY_AGENT_ID=$(openssl rand -base64 45 | tr -d '/+=')
  960. echo "::add-mask::${MCP_GATEWAY_AGENT_ID}"
  961. export MCP_GATEWAY_AGENT_ID
  962. export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads"
  963. mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}"
  964. export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288"
  965. 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"
  966. export GH_AW_PR_HEAD_BASE_BRANCH="${GH_AW_PR_HEAD_BASE_BRANCH:-}"
  967. export GH_AW_PR_HEAD_BASE_SHA="${GH_AW_PR_HEAD_BASE_SHA:-}"
  968. export GH_AW_PR_HEAD_BASE_REPO="${GH_AW_PR_HEAD_BASE_REPO:-}"
  969. export GH_AW_PR_HEAD_BASE_PR_NUMBER="${GH_AW_PR_HEAD_BASE_PR_NUMBER:-}"
  970. export GH_AW_PR_HEAD_BASE_REF="${GH_AW_PR_HEAD_BASE_REF:-}"
  971. export GH_AW_PR_HEAD_REPO="${GH_AW_PR_HEAD_REPO:-}"
  972. export GH_AW_TARGET_REPO_SLUG="${GH_AW_TARGET_REPO_SLUG:-}"
  973. export GH_AW_ENGINE="codex"
  974. MCP_GATEWAY_UID=$(id -u 2>/dev/null || echo '0')
  975. MCP_GATEWAY_GID=$(id -g 2>/dev/null || echo '0')
  976. source "${RUNNER_TEMP}/gh-aw/actions/resolve_docker_socket_gid.sh"
  977. 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_TARGET_REPO_SLUG -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 -e GH_AW_GUARD_APPROVAL_LABELS -e GH_AW_GUARD_BLOCKED_USERS -e GH_AW_GUARD_TRUSTED_USERS -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.5.0@sha256:d3544a4222e7efeeeb38669d8a1af0c72691c55b8f6506b15aa5920f7f31b7bc'
  978. export GH_AW_CODEX_CONFIG="${RUNNER_TEMP}/gh-aw/mcp-config/codex-config.json"
  979. # Generate JSON config for MCP gateway
  980. GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node)
  981. cat << GH_AW_MCP_CONFIG_95b323f79afd06cf_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs"
  982. {
  983. "mcpServers": {
  984. "github": {
  985. "container": "ghcr.io/github/github-mcp-server:v2.0.3",
  986. "env": {
  987. "GITHUB_FEATURES": "fields_param",
  988. "GITHUB_HOST": "$GITHUB_SERVER_URL",
  989. "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_MCP_SERVER_TOKEN",
  990. "GITHUB_READ_ONLY": "1",
  991. "GITHUB_TOOLSETS": "context,repos,issues,pull_requests"
  992. },
  993. "guard-policies": {
  994. "allow-only": {
  995. "approval-labels": ${GH_AW_GUARD_APPROVAL_LABELS},
  996. "blocked-users": ${GH_AW_GUARD_BLOCKED_USERS},
  997. "min-integrity": "none",
  998. "repos": "all",
  999. "trusted-users": ${GH_AW_GUARD_TRUSTED_USERS}
  1000. }
  1001. }
  1002. },
  1003. "safeoutputs": {
  1004. "container": "ghcr.io/github/gh-aw-node@sha256:2c2ea524e648b91c8333ce246e3838fcf5b19ac70e45baac1a51b9207299749f",
  1005. "mounts": ["\${GITHUB_WORKSPACE}:\${GITHUB_WORKSPACE}:rw", "${RUNNER_TEMP}/gh-aw/safeoutputs:${RUNNER_TEMP}/gh-aw/safeoutputs:rw", "/tmp/gh-aw:/tmp/gh-aw:rw"],
  1006. "args": ["-w", "\${GITHUB_WORKSPACE}"],
  1007. "entrypoint": "sh",
  1008. "entrypointArgs": ["-c", "sh ${RUNNER_TEMP}/gh-aw/safeoutputs/start_safe_outputs_mcp.sh"],
  1009. "env": {
  1010. "DEBUG": "\${DEBUG}",
  1011. "DEFAULT_BRANCH": "\${DEFAULT_BRANCH}",
  1012. "GH_AW_ASSETS_ALLOWED_EXTS": "\${GH_AW_ASSETS_ALLOWED_EXTS}",
  1013. "GH_AW_ASSETS_BRANCH": "\${GH_AW_ASSETS_BRANCH}",
  1014. "GH_AW_ASSETS_MAX_SIZE_KB": "\${GH_AW_ASSETS_MAX_SIZE_KB}",
  1015. "GH_AW_MCP_LOG_DIR": "\${GH_AW_MCP_LOG_DIR}",
  1016. "GH_AW_SAFE_OUTPUTS": "\${GH_AW_SAFE_OUTPUTS}",
  1017. "GH_AW_SAFE_OUTPUTS_CONFIG_PATH": "\${GH_AW_SAFE_OUTPUTS_CONFIG_PATH}",
  1018. "GH_AW_SAFE_OUTPUTS_TOOLS_PATH": "\${GH_AW_SAFE_OUTPUTS_TOOLS_PATH}",
  1019. "GH_AW_TARGET_REPO_SLUG": "\${GH_AW_TARGET_REPO_SLUG}",
  1020. "GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST": "\${GH_AW_POLICY_ALLOW_CREATE_PULL_REQUEST}",
  1021. "GH_AW_PR_HEAD_BASE_BRANCH": "\${GH_AW_PR_HEAD_BASE_BRANCH}",
  1022. "GH_AW_PR_HEAD_BASE_SHA": "\${GH_AW_PR_HEAD_BASE_SHA}",
  1023. "GH_AW_PR_HEAD_BASE_REPO": "\${GH_AW_PR_HEAD_BASE_REPO}",
  1024. "GH_AW_PR_HEAD_BASE_PR_NUMBER": "\${GH_AW_PR_HEAD_BASE_PR_NUMBER}",
  1025. "GH_AW_PR_HEAD_BASE_REF": "\${GH_AW_PR_HEAD_BASE_REF}",
  1026. "GH_AW_PR_HEAD_REPO": "\${GH_AW_PR_HEAD_REPO}",
  1027. "GITHUB_EVENT_NAME": "\${GITHUB_EVENT_NAME}",
  1028. "GITHUB_EVENT_PATH": "\${GITHUB_EVENT_PATH}",
  1029. "GITHUB_REPOSITORY": "\${GITHUB_REPOSITORY}",
  1030. "GITHUB_SHA": "\${GITHUB_SHA}",
  1031. "GITHUB_TOKEN": "\${GITHUB_TOKEN}",
  1032. "GITHUB_WORKSPACE": "\${GITHUB_WORKSPACE}",
  1033. "RUNNER_TEMP": "\${RUNNER_TEMP}"
  1034. },
  1035. "guard-policies": {
  1036. "write-sink": {
  1037. "accept": [
  1038. "*"
  1039. ],
  1040. "sink-visibility": "${GH_AW_SINK_VISIBILITY}"
  1041. }
  1042. }
  1043. }
  1044. },
  1045. "gateway": {
  1046. "port": $MCP_GATEWAY_PORT,
  1047. "domain": "${MCP_GATEWAY_DOMAIN}",
  1048. "agentId": "${MCP_GATEWAY_AGENT_ID}",
  1049. "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}",
  1050. "startupTimeout": 120,
  1051. "opentelemetry": {
  1052. "endpoint": "${OTEL_EXPORTER_OTLP_ENDPOINT}",
  1053. "traceId": "${GITHUB_AW_OTEL_TRACE_ID}",
  1054. "spanId": "${GITHUB_AW_OTEL_PARENT_SPAN_ID}"
  1055. }
  1056. }
  1057. }
  1058. GH_AW_MCP_CONFIG_95b323f79afd06cf_EOF
  1059. # Sync converter output to writable CODEX_HOME for Codex
  1060. mkdir -p "${CODEX_HOME}"
  1061. if [ "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" != "${CODEX_HOME}/config.toml" ]; then cp "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" "${CODEX_HOME}/config.toml"; fi
  1062. chmod 600 "${CODEX_HOME}/config.toml"
  1063. - name: Mount MCP servers as CLIs
  1064. id: mount-mcp-clis
  1065. continue-on-error: true
  1066. env:
  1067. MCP_GATEWAY_AGENT_ID: ${{ steps.start-mcp-gateway.outputs.gateway-agent-id }}
  1068. MCP_GATEWAY_DOMAIN: ${{ steps.start-mcp-gateway.outputs.gateway-domain }}
  1069. MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }}
  1070. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1071. with:
  1072. script: |
  1073. const path = require('path');
  1074. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1075. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1076. setupGlobals(core, github, context, exec, io);
  1077. const { main } = require(path.join(actionsDir, 'mount_mcp_as_cli.cjs'));
  1078. await main();
  1079. - name: Clean credentials
  1080. run: |
  1081. bash "${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh"
  1082. bash "${RUNNER_TEMP}/gh-aw/actions/verify_git_credentials.sh"
  1083. - name: Audit pre-agent workspace
  1084. id: pre_agent_audit
  1085. continue-on-error: true
  1086. run: bash "${RUNNER_TEMP}/gh-aw/actions/audit_pre_agent_workspace.sh"
  1087. - name: Log GitHub rate limits at agent start
  1088. continue-on-error: true
  1089. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1090. with:
  1091. github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1092. script: |
  1093. const path = require('path');
  1094. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1095. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1096. setupGlobals(core, github, context, exec, io, getOctokit);
  1097. const { fetchAndLogRateLimit } = require(path.join(actionsDir, 'github_rate_limit_logger.cjs'));
  1098. await fetchAndLogRateLimit(github, 'agent_start', true);
  1099. - name: Execute Codex CLI
  1100. id: agentic_execution
  1101. timeout-minutes: 5
  1102. run: |
  1103. set -o pipefail
  1104. gh_aw_exit_code=0
  1105. 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
  1106. printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt
  1107. mkdir -p "$CODEX_HOME/logs" && touch /tmp/gh-aw/agent-step-summary.md
  1108. (umask 177 && touch /tmp/gh-aw/agent-stdio.log)
  1109. GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-1000}"
  1110. if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^[0-9]+$ ]]; then
  1111. GH_AW_MAX_AI_CREDITS="1000"
  1112. fi
  1113. if [[ "${GH_AW_ADMISSION_RESULT:-}" == "admitted" && -z "${GH_AW_ADMISSION_MAX_AI_CREDITS:-}" ]]; then
  1114. echo "ERR_ADMISSION: Missing required runtime admission allowance." >&2
  1115. exit 1
  1116. fi
  1117. if [[ "${GH_AW_ADMISSION_RESULT:-}" == "admitted" && -n "${GH_AW_ADMISSION_MAX_AI_CREDITS:-}" ]]; then
  1118. if [[ ! "$GH_AW_ADMISSION_MAX_AI_CREDITS" =~ ^[1-9][0-9]{0,9}$ ]] || (( GH_AW_ADMISSION_MAX_AI_CREDITS > 2147483647 )); then
  1119. echo "ERR_ADMISSION: Invalid runtime admission allowance." >&2
  1120. exit 1
  1121. fi
  1122. GH_AW_MAX_AI_CREDITS="$GH_AW_ADMISSION_MAX_AI_CREDITS"
  1123. echo "Admission allowance applied (value withheld)."
  1124. else
  1125. echo "No component admission allowance; retaining existing budget policy (value withheld)."
  1126. fi
  1127. unset GH_AW_ADMISSION_RESULT GH_AW_ADMISSION_MAX_AI_CREDITS
  1128. printf '%s\n' "{\"\$schema\":\"https://github.com/github/gh-aw-firewall/releases/download/v0.29.0/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,\"hostedWeb\":{\"codex\":{\"enabled\":false}},\"maxRuns\":500,\"maxAiCredits\":${GH_AW_MAX_AI_CREDITS},\"maxCacheMisses\":5,\"modelFallback\":{\"enabled\":false},\"targets\":{\"openai\":{\"host\":\"ai-pixel.online\"}},\"providers\":{\"openai\":{\"models\":{\"gpt-5.6-luna\":{\"cost\":{\"cache_read\":\"2e-08\",\"cache_write\":\"2.5e-07\",\"input\":\"2e-07\",\"output\":\"1.2e-06\"}}}}},\"models\":{\"agent\":[\"sonnet-6x\",\"gpt-6\",\"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-3.8-flash\":[\"copilot/gemini-3.8*flash*\",\"google/gemini-3.8*flash*\",\"gemini/gemini-3.8*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*\"],\"gpt-6\":[\"copilot/gpt-6*\",\"openai/gpt-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-6\",\"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*\"],\"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.29.0,squid=sha256:6e0cbf7f980beb78b5461563a8164f6439ca959bc93733d5a6b52972e523ed50,agent=sha256:b14bd399376180b5649a9324be3b50fbfc82bfe8f0c80045840416b5a4e65b96,api-proxy=sha256:baff00b856a4bdc93bce134928c70af3d3492f2e518757115042040674d56b0b,cli-proxy=sha256:087a8e4efff8ac62d46e106cd22005c002822b1481fc233097799511be353b5d\",\"agentTimeout\":5},\"logging\":{\"proxyLogsDir\":\"/tmp/gh-aw/sandbox/firewall/logs\",\"auditDir\":\"/tmp/gh-aw/sandbox/firewall/audit\"}}" > "${RUNNER_TEMP}/gh-aw/awf-config.json"
  1129. cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json
  1130. export GH_AW_MODELS_JSON_PATH="/tmp/gh-aw/models.json"
  1131. GH_AW_DOCKER_HOST=""
  1132. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  1133. GH_AW_DOCKER_HOST="${DOCKER_HOST}"
  1134. fi
  1135. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  1136. 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"
  1137. fi
  1138. GH_AW_TOOL_CACHE_MOUNT=""
  1139. GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"
  1140. if [ -d "$GH_AW_TOOL_CACHE" ]; then
  1141. if [[ "$GH_AW_TOOL_CACHE" != /opt/* ]]; then
  1142. GH_AW_TOOL_CACHE_MOUNT="$GH_AW_TOOL_CACHE:$GH_AW_TOOL_CACHE:ro"
  1143. fi
  1144. fi
  1145. # shellcheck disable=SC1003,SC2016,SC2086
  1146. mkdir -p "/tmp/gh-aw"
  1147. evidence_tmp="/tmp/gh-aw/agent_execution.json.tmp"
  1148. printf '{"version":1,"component":"agent","run_id":%s,"run_attempt":%s,"state":"started"}\n' "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" > "$evidence_tmp"
  1149. mv "$evidence_tmp" "/tmp/gh-aw/agent_execution.json"
  1150. export GH_AW_AWF_EXECUTION_COMPONENT="agent"
  1151. export GH_AW_AWF_EXECUTION_EVIDENCE_FILE="/tmp/gh-aw/agent_execution.json"
  1152. GH_AW_AWF_ENGINE_NAME=codex \
  1153. GH_AW_AWF_HARNESS_MARKER='[codex-harness]' \
  1154. GH_AW_AWF_LOG_FILE=/tmp/gh-aw/agent-stdio.log \
  1155. GH_AW_AWF_ATTEMPT_LOG_NAME=codex \
  1156. bash "${RUNNER_TEMP}/gh-aw/actions/run_awf_with_startup_retries.sh" -- \
  1157. 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 GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_AGENT_ID --exclude-env OPENAI_API_KEY --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --mount /tmp/gh-aw:/tmp/gh-aw:rw --log-level info --skip-pull \
  1158. -- /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"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -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" --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt'
  1159. env:
  1160. AWF_REFLECT_ENABLED: 1
  1161. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }}
  1162. CODEX_HOME: /tmp/gh-aw/mcp-config
  1163. GH_AW_LLM_PROVIDER: openai
  1164. GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }}
  1165. GH_AW_MAX_TURNS: ${{ vars.GH_AW_DEFAULT_MAX_TURNS || '' }}
  1166. GH_AW_MCP_CONFIG: ${{ runner.temp }}/gh-aw/mcp-config/config.toml
  1167. GH_AW_MODEL_AGENT_CODEX: gpt-5.6-luna
  1168. GH_AW_PHASE: agent
  1169. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  1170. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  1171. GH_AW_VERSION: v1.0.1
  1172. GITHUB_AW: true
  1173. GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
  1174. GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
  1175. GIT_AUTHOR_NAME: github-actions[bot]
  1176. GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
  1177. GIT_COMMITTER_NAME: github-actions[bot]
  1178. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1179. OPENAI_BASE_URL: https://ai-pixel.online
  1180. RUNNER_TEMP: ${{ runner.temp }}
  1181. 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' }}
  1182. 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) || '' }}
  1183. - name: Log GitHub rate limits at agent end
  1184. if: always()
  1185. continue-on-error: true
  1186. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1187. with:
  1188. github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1189. script: |
  1190. const path = require('path');
  1191. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1192. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1193. setupGlobals(core, github, context, exec, io, getOctokit);
  1194. const { fetchAndLogRateLimit } = require(path.join(actionsDir, 'github_rate_limit_logger.cjs'));
  1195. await fetchAndLogRateLimit(github, 'agent_end', true);
  1196. - name: Detect agent errors
  1197. if: always()
  1198. id: detect-agent-errors
  1199. continue-on-error: true
  1200. env:
  1201. GH_AW_AGENTIC_EXECUTION_OUTCOME: ${{ steps.agentic_execution.outcome }}
  1202. GH_AW_ENGINE_STEP_TIMEOUT_MINUTES: 5
  1203. GH_AW_ENGINE_INTERNAL_LOGS_DIR: /tmp/gh-aw/mcp-config/logs
  1204. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1205. with:
  1206. script: |
  1207. const path = require('path');
  1208. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1209. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1210. setupGlobals(core, github, context, exec, io, getOctokit);
  1211. const { main } = require(path.join(actionsDir, 'detect_agent_errors.cjs'));
  1212. await main();
  1213. - name: Configure Git credentials
  1214. env:
  1215. GITHUB_REPOSITORY: ${{ github.repository }}
  1216. GITHUB_SERVER_URL: ${{ github.server_url }}
  1217. GITHUB_TOKEN: ${{ github.token }}
  1218. run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh"
  1219. - name: Stop MCP Gateway
  1220. if: always()
  1221. continue-on-error: true
  1222. env:
  1223. MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }}
  1224. MCP_GATEWAY_AGENT_ID: ${{ steps.start-mcp-gateway.outputs.gateway-agent-id }}
  1225. GATEWAY_PID: ${{ steps.start-mcp-gateway.outputs.gateway-pid }}
  1226. run: |
  1227. bash "${RUNNER_TEMP}/gh-aw/actions/stop_mcp_gateway.sh" "$GATEWAY_PID"
  1228. - name: Redact secrets in logs
  1229. id: redact_secrets
  1230. if: always()
  1231. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1232. with:
  1233. script: |
  1234. const path = require('path');
  1235. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1236. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1237. setupGlobals(core, github, context, exec, io, getOctokit);
  1238. const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
  1239. await main();
  1240. env:
  1241. 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'
  1242. SECRET_CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  1243. SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  1244. SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  1245. SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  1246. SECRET_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  1247. SECRET_PIXEL_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1248. - name: Append agent step summary
  1249. if: always()
  1250. run: bash "${RUNNER_TEMP}/gh-aw/actions/append_agent_step_summary.sh"
  1251. - name: Copy Safe Outputs
  1252. if: always()
  1253. env:
  1254. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  1255. run: |
  1256. mkdir -p /tmp/gh-aw
  1257. cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true
  1258. - name: Ingest agent output
  1259. id: collect_output
  1260. if: always()
  1261. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1262. env:
  1263. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  1264. 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"
  1265. GITHUB_SERVER_URL: ${{ github.server_url }}
  1266. GITHUB_API_URL: ${{ github.api_url }}
  1267. with:
  1268. script: |
  1269. const path = require('path');
  1270. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1271. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1272. setupGlobals(core, github, context, exec, io, getOctokit);
  1273. const { main } = require(path.join(actionsDir, 'collect_ndjson_output.cjs'));
  1274. await main();
  1275. - name: Parse agent logs for step summary
  1276. if: always()
  1277. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1278. env:
  1279. GH_AW_AGENT_OUTPUT: /tmp/gh-aw/agent-stdio.log
  1280. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  1281. with:
  1282. script: |
  1283. const path = require('path');
  1284. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1285. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1286. setupGlobals(core, github, context, exec, io, getOctokit);
  1287. const { main } = require(path.join(actionsDir, 'parse_codex_log.cjs'));
  1288. await main();
  1289. - name: Parse MCP Gateway logs for step summary
  1290. if: always()
  1291. id: parse-mcp-gateway
  1292. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1293. with:
  1294. script: |
  1295. const path = require('path');
  1296. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1297. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1298. setupGlobals(core, github, context, exec, io, getOctokit);
  1299. const { main } = require(path.join(actionsDir, 'parse_mcp_gateway_log.cjs'));
  1300. await main();
  1301. - name: Print firewall logs
  1302. if: always()
  1303. continue-on-error: true
  1304. env:
  1305. AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs
  1306. run: bash "${RUNNER_TEMP}/gh-aw/actions/print_firewall_logs.sh" --rootless
  1307. - name: Parse token usage for step summary
  1308. if: always()
  1309. id: parse-token-usage
  1310. continue-on-error: true
  1311. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1312. with:
  1313. script: |
  1314. const path = require('path');
  1315. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1316. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1317. setupGlobals(core, github, context, exec, io, getOctokit);
  1318. const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
  1319. await main();
  1320. - name: Print AWF reflect summary
  1321. if: always()
  1322. continue-on-error: true
  1323. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1324. with:
  1325. script: |
  1326. const path = require('path');
  1327. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1328. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1329. setupGlobals(core, github, context, exec, io, getOctokit);
  1330. const { main } = require(path.join(actionsDir, 'awf_reflect_summary.cjs'));
  1331. await main();
  1332. - name: Generate observability summary
  1333. if: always()
  1334. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1335. with:
  1336. script: |
  1337. const path = require('path');
  1338. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1339. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1340. setupGlobals(core, github, context, exec, io, getOctokit);
  1341. const { main } = require(path.join(actionsDir, 'generate_observability_summary.cjs'));
  1342. await main(core);
  1343. - name: Write agent output placeholder if missing
  1344. if: always()
  1345. run: |
  1346. if [ ! -f /tmp/gh-aw/agent_output.json ]; then
  1347. echo '{"items":[]}' > /tmp/gh-aw/agent_output.json
  1348. fi
  1349. # Small dedicated copy of the agent output so safe-output processing
  1350. # survives a failed or timed-out upload of the larger agent artifact
  1351. - name: Upload agent output fallback artifact
  1352. if: always() && steps.redact_secrets.outcome == 'success'
  1353. continue-on-error: true
  1354. uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
  1355. with:
  1356. name: agent-output-fallback
  1357. path: |
  1358. /tmp/gh-aw/agent_output.json
  1359. /tmp/gh-aw/safeoutputs.jsonl
  1360. /tmp/gh-aw/agent_execution.json
  1361. /tmp/gh-aw/agent_execution_exit_code.txt
  1362. /tmp/gh-aw/agent_usage.jsonl
  1363. /tmp/gh-aw/agent_usage.json
  1364. /tmp/gh-aw/agent/harness_retry.json
  1365. /tmp/gh-aw/agent/model-endpoint-mismatch.json
  1366. /tmp/gh-aw/sandbox/firewall-audit-logs/api-proxy-logs/token-usage.jsonl
  1367. /tmp/gh-aw/sandbox/firewall-audit-logs/api-proxy-logs/model-routing.jsonl
  1368. /tmp/gh-aw/sandbox/firewall/logs/api-proxy-logs/token-usage.jsonl
  1369. /tmp/gh-aw/sandbox/firewall/logs/api-proxy-logs/model-routing.jsonl
  1370. /tmp/gh-aw/sandbox/firewall/audit/api-proxy-logs/token-usage.jsonl
  1371. /tmp/gh-aw/sandbox/firewall/audit/api-proxy-logs/model-routing.jsonl
  1372. /tmp/gh-aw/awf-resolved-config.json
  1373. if-no-files-found: ignore
  1374. retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
  1375. - name: Upload agent artifacts
  1376. if: always() && steps.redact_secrets.outcome == 'success'
  1377. continue-on-error: true
  1378. uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
  1379. with:
  1380. name: agent
  1381. path: |
  1382. /tmp/gh-aw/aw-prompts/prompt.txt
  1383. /tmp/gh-aw/agent_execution.json
  1384. /tmp/gh-aw/agent_execution_exit_code.txt
  1385. /tmp/gh-aw/agent-session.jsonl
  1386. /tmp/gh-aw/agent-errors.jsonl
  1387. /tmp/gh-aw/aw-prompts/user.txt
  1388. /tmp/gh-aw/aw-prompts/system.txt
  1389. /tmp/gh-aw/skill_inventory.json
  1390. /tmp/gh-aw/mcp-config/logs/
  1391. /tmp/gh-aw/redacted-urls.log
  1392. /tmp/gh-aw/mcp-logs/
  1393. /tmp/gh-aw/proxy-logs/
  1394. !/tmp/gh-aw/proxy-logs/proxy-tls/
  1395. /tmp/gh-aw/agent_usage.json
  1396. /tmp/gh-aw/agent/model-resolution.json
  1397. /tmp/gh-aw/agent-stdio.log
  1398. /tmp/gh-aw/agent/harness_retry.json
  1399. /tmp/gh-aw/pre-agent-audit.txt
  1400. /tmp/gh-aw/github_rate_limits.jsonl
  1401. /tmp/gh-aw/otel.jsonl
  1402. /tmp/gh-aw/otlp-export-errors.jsonl
  1403. /tmp/gh-aw/safeoutputs.jsonl
  1404. /tmp/gh-aw/agent_output.json
  1405. /tmp/gh-aw/aw-*.patch
  1406. /tmp/gh-aw/aw-*.bundle
  1407. /tmp/gh-aw/awf-config.json
  1408. /tmp/gh-aw/awf-resolved-config.json
  1409. /tmp/gh-aw/sandbox/firewall/logs/
  1410. /tmp/gh-aw/sandbox/firewall/audit/
  1411. /tmp/gh-aw/sandbox/firewall/awf-reflect.json
  1412. if-no-files-found: ignore
  1413. retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
  1414. call-issue-handle-bug:
  1415. name: call-issue-handle-bug
  1416. needs: safe_outputs
  1417. if: "${{ (needs.safe_outputs.outputs.call_workflow_name == 'issue-handle-bug') }}"
  1418. # Imported from called workflow "issue-handle-bug" because GitHub requires the caller job to grant permissions requested by reusable workflow jobs.
  1419. # Review the called workflow's job-level permissions in ./.github/workflows/issue-handle-bug.lock.yml.
  1420. permissions:
  1421. actions: read
  1422. checks: read
  1423. contents: read
  1424. discussions: read
  1425. id-token: write
  1426. issues: write
  1427. pull-requests: write
  1428. statuses: read
  1429. uses: ./.github/workflows/issue-handle-bug.lock.yml
  1430. with:
  1431. aw_context: ${{ fromJSON(needs.safe_outputs.outputs.call_workflow_payload).aw_context }}
  1432. issue_number: ${{ fromJSON(needs.safe_outputs.outputs.call_workflow_payload).issue_number }}
  1433. payload: ${{ needs.safe_outputs.outputs.call_workflow_payload }}
  1434. secrets:
  1435. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  1436. COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
  1437. GH_AW_DEFAULT_OTLP_ENDPOINT: ${{ secrets.GH_AW_DEFAULT_OTLP_ENDPOINT }}
  1438. GH_AW_DEFAULT_OTLP_HEADERS: ${{ secrets.GH_AW_DEFAULT_OTLP_HEADERS }}
  1439. GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  1440. GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  1441. OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  1442. PIXEL_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1443. call-issue-handle-enhancement:
  1444. name: call-issue-handle-enhancement
  1445. needs: safe_outputs
  1446. if: "${{ (needs.safe_outputs.outputs.call_workflow_name == 'issue-handle-enhancement') }}"
  1447. # Imported from called workflow "issue-handle-enhancement" because GitHub requires the caller job to grant permissions requested by reusable workflow jobs.
  1448. # Review the called workflow's job-level permissions in ./.github/workflows/issue-handle-enhancement.lock.yml.
  1449. permissions:
  1450. actions: read
  1451. checks: read
  1452. contents: read
  1453. discussions: read
  1454. id-token: write
  1455. issues: write
  1456. pull-requests: write
  1457. statuses: read
  1458. uses: ./.github/workflows/issue-handle-enhancement.lock.yml
  1459. with:
  1460. aw_context: ${{ fromJSON(needs.safe_outputs.outputs.call_workflow_payload).aw_context }}
  1461. issue_number: ${{ fromJSON(needs.safe_outputs.outputs.call_workflow_payload).issue_number }}
  1462. payload: ${{ needs.safe_outputs.outputs.call_workflow_payload }}
  1463. secrets:
  1464. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  1465. COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
  1466. GH_AW_DEFAULT_OTLP_ENDPOINT: ${{ secrets.GH_AW_DEFAULT_OTLP_ENDPOINT }}
  1467. GH_AW_DEFAULT_OTLP_HEADERS: ${{ secrets.GH_AW_DEFAULT_OTLP_HEADERS }}
  1468. GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  1469. GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  1470. OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  1471. PIXEL_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1472. call-issue-handle-other:
  1473. name: call-issue-handle-other
  1474. needs: safe_outputs
  1475. if: "${{ (needs.safe_outputs.outputs.call_workflow_name == 'issue-handle-other') }}"
  1476. # Imported from called workflow "issue-handle-other" because GitHub requires the caller job to grant permissions requested by reusable workflow jobs.
  1477. # Review the called workflow's job-level permissions in ./.github/workflows/issue-handle-other.lock.yml.
  1478. permissions:
  1479. actions: read
  1480. checks: read
  1481. contents: read
  1482. discussions: read
  1483. id-token: write
  1484. issues: write
  1485. pull-requests: write
  1486. statuses: read
  1487. uses: ./.github/workflows/issue-handle-other.lock.yml
  1488. with:
  1489. aw_context: ${{ fromJSON(needs.safe_outputs.outputs.call_workflow_payload).aw_context }}
  1490. issue_number: ${{ fromJSON(needs.safe_outputs.outputs.call_workflow_payload).issue_number }}
  1491. payload: ${{ needs.safe_outputs.outputs.call_workflow_payload }}
  1492. secrets:
  1493. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  1494. COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
  1495. GH_AW_DEFAULT_OTLP_ENDPOINT: ${{ secrets.GH_AW_DEFAULT_OTLP_ENDPOINT }}
  1496. GH_AW_DEFAULT_OTLP_HEADERS: ${{ secrets.GH_AW_DEFAULT_OTLP_HEADERS }}
  1497. GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  1498. GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  1499. OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  1500. PIXEL_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1501. call-issue-handle-question:
  1502. name: call-issue-handle-question
  1503. needs: safe_outputs
  1504. if: "${{ (needs.safe_outputs.outputs.call_workflow_name == 'issue-handle-question') }}"
  1505. # Imported from called workflow "issue-handle-question" because GitHub requires the caller job to grant permissions requested by reusable workflow jobs.
  1506. # Review the called workflow's job-level permissions in ./.github/workflows/issue-handle-question.lock.yml.
  1507. permissions:
  1508. actions: read
  1509. checks: read
  1510. contents: read
  1511. discussions: read
  1512. id-token: write
  1513. issues: write
  1514. pull-requests: write
  1515. statuses: read
  1516. uses: ./.github/workflows/issue-handle-question.lock.yml
  1517. with:
  1518. aw_context: ${{ fromJSON(needs.safe_outputs.outputs.call_workflow_payload).aw_context }}
  1519. issue_number: ${{ fromJSON(needs.safe_outputs.outputs.call_workflow_payload).issue_number }}
  1520. payload: ${{ needs.safe_outputs.outputs.call_workflow_payload }}
  1521. secrets:
  1522. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  1523. COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
  1524. GH_AW_DEFAULT_OTLP_ENDPOINT: ${{ secrets.GH_AW_DEFAULT_OTLP_ENDPOINT }}
  1525. GH_AW_DEFAULT_OTLP_HEADERS: ${{ secrets.GH_AW_DEFAULT_OTLP_HEADERS }}
  1526. GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  1527. GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  1528. OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  1529. PIXEL_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1530. conclusion:
  1531. name: conclusion
  1532. needs:
  1533. - activation
  1534. - agent
  1535. - call-issue-handle-bug
  1536. - call-issue-handle-enhancement
  1537. - call-issue-handle-other
  1538. - call-issue-handle-question
  1539. - detection
  1540. - safe_outputs
  1541. if: >
  1542. always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true' ||
  1543. needs.activation.outputs.oauth_token_check_failed == 'true' || needs.activation.outputs.stale_lock_file_failed == 'true' ||
  1544. needs.activation.outputs.secret_verification_result == 'failed' || needs.activation.outputs.daily_ai_credits_exceeded == 'true' ||
  1545. needs.activation.outputs.daily_ai_credits_guardrail_status == 'structural_error' || needs.activation.outputs.daily_ai_credits_guardrail_status == 'transient_error')
  1546. runs-on: ubuntu-slim
  1547. # Permissions for the conclusion job (workflow permissions default to none).
  1548. permissions:
  1549. actions: read
  1550. checks: read
  1551. issues: write
  1552. pull-requests: write
  1553. concurrency:
  1554. group: "gh-aw-conclusion-issue-triage-${{ inputs.issue_number || github.event.issue.number || github.run_id }}"
  1555. cancel-in-progress: false
  1556. queue: max
  1557. env:
  1558. GH_AW_JOB_DISPLAY_NAMES: "{\"activation\":\"activation\",\"agent\":\"agent\",\"call-issue-handle-bug\":\"call-issue-handle-bug\",\"call-issue-handle-enhancement\":\"call-issue-handle-enhancement\",\"call-issue-handle-other\":\"call-issue-handle-other\",\"call-issue-handle-question\":\"call-issue-handle-question\",\"conclusion\":\"conclusion\",\"detection\":\"detection\",\"safe_outputs\":\"safe_outputs\"}"
  1559. GH_AW_JOB_RESULTS: "{\"activation\":{\"result\":\"${{ needs.activation.result }}\"},\"agent\":{\"result\":\"${{ needs.agent.result }}\"},\"call-issue-handle-bug\":{\"result\":\"${{ needs.call-issue-handle-bug.result }}\"},\"call-issue-handle-enhancement\":{\"result\":\"${{ needs.call-issue-handle-enhancement.result }}\"},\"call-issue-handle-other\":{\"result\":\"${{ needs.call-issue-handle-other.result }}\"},\"call-issue-handle-question\":{\"result\":\"${{ needs.call-issue-handle-question.result }}\"},\"detection\":{\"result\":\"${{ needs.detection.result }}\"},\"safe_outputs\":{\"result\":\"${{ needs.safe_outputs.result }}\"}}"
  1560. GH_AW_JOB_TIMING_ELIGIBLE: "{\"activation\":true,\"agent\":true,\"call-issue-handle-bug\":false,\"call-issue-handle-enhancement\":false,\"call-issue-handle-other\":false,\"call-issue-handle-question\":false,\"conclusion\":true,\"detection\":true,\"safe_outputs\":true}"
  1561. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  1562. outputs:
  1563. incomplete_count: ${{ steps.report_incomplete.outputs.incomplete_count }}
  1564. noop_comment_body: ${{ steps.noop.outputs.noop_comment_body }}
  1565. noop_message: ${{ steps.noop.outputs.noop_message }}
  1566. tools_reported: ${{ steps.missing_tool.outputs.tools_reported }}
  1567. total_count: ${{ steps.missing_tool.outputs.total_count }}
  1568. steps:
  1569. - name: Setup Scripts
  1570. id: setup
  1571. uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
  1572. with:
  1573. destination: ${{ runner.temp }}/gh-aw/actions
  1574. job-name: ${{ github.job }}
  1575. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1576. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  1577. env:
  1578. GH_AW_SETUP_WORKFLOW_NAME: "Issue Triage"
  1579. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-triage.lock.yml@${{ github.ref }}
  1580. GH_AW_INFO_VERSION: "0.164.0"
  1581. GH_AW_INFO_AWF_VERSION: "v0.29.0"
  1582. GH_AW_INFO_ENGINE_ID: "codex"
  1583. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  1584. - name: Download agent output artifact
  1585. id: download-agent-output
  1586. continue-on-error: true
  1587. uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
  1588. with:
  1589. pattern: "{agent,agent-output-fallback}"
  1590. merge-multiple: true
  1591. path: /tmp/gh-aw/
  1592. - name: Setup agent output environment variable
  1593. id: setup-agent-output-env
  1594. if: steps.download-agent-output.outcome == 'success'
  1595. run: |
  1596. mkdir -p /tmp/gh-aw/
  1597. find "/tmp/gh-aw/" -type f -print
  1598. if [ -f "/tmp/gh-aw/agent_output.json" ]; then
  1599. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1600. fi
  1601. - name: Warn if threat detection produced no verdict
  1602. if: always() && needs.detection.result != 'skipped' && (needs.detection.outputs.detection_reason == 'agent_failure' || needs.detection.outputs.detection_reason == 'parse_error' || needs.detection.outputs.detection_conclusion == '')
  1603. run: echo "::warning::Threat detection produced no security verdict. Review the detection job logs before trusting the agent outputs."
  1604. - name: Download detection artifact
  1605. id: download-detection-artifact
  1606. continue-on-error: true
  1607. uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
  1608. with:
  1609. name: detection
  1610. path: /tmp/gh-aw/threat-detection/
  1611. - name: Download Safe Outputs Items Manifest
  1612. id: download-safe-outputs-manifest
  1613. if: always()
  1614. continue-on-error: true
  1615. uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
  1616. with:
  1617. pattern: safe-outputs-items
  1618. merge-multiple: true
  1619. path: /tmp/gh-aw/
  1620. - name: Process no-op messages
  1621. id: noop
  1622. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1623. env:
  1624. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1625. GH_AW_NOOP_MAX: "2"
  1626. GH_AW_WORKFLOW_NAME: "Issue Triage"
  1627. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-triage.md"
  1628. GH_AW_ENGINE_ID: "codex"
  1629. GH_AW_ENGINE_MODEL: "gpt-5.6-luna"
  1630. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1631. GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
  1632. GH_AW_NOOP_REPORT_AS_ISSUE: "false"
  1633. GH_AW_AIC: ${{ needs.agent.outputs.aic }}
  1634. GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }}
  1635. GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }}
  1636. GH_AW_WORKFLOW_ID: "issue-triage"
  1637. with:
  1638. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1639. script: |
  1640. const path = require('path');
  1641. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1642. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1643. setupGlobals(core, github, context, exec, io, getOctokit);
  1644. const { main } = require(path.join(actionsDir, 'handle_noop_message.cjs'));
  1645. await main();
  1646. - name: Log detection run
  1647. id: detection_runs
  1648. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1649. env:
  1650. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1651. GH_AW_WORKFLOW_NAME: "Issue Triage"
  1652. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-triage.md"
  1653. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1654. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  1655. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  1656. with:
  1657. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1658. script: |
  1659. const path = require('path');
  1660. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1661. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1662. setupGlobals(core, github, context, exec, io, getOctokit);
  1663. const { main } = require(path.join(actionsDir, 'handle_detection_runs.cjs'));
  1664. await main();
  1665. - name: Record missing tool
  1666. id: missing_tool
  1667. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1668. env:
  1669. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1670. GH_AW_MISSING_TOOL_CREATE_ISSUE: "true"
  1671. GH_AW_WORKFLOW_NAME: "Issue Triage"
  1672. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-triage.md"
  1673. GH_AW_ENGINE_ID: "codex"
  1674. GH_AW_ENGINE_MODEL: "gpt-5.6-luna"
  1675. with:
  1676. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1677. script: |
  1678. const path = require('path');
  1679. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1680. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1681. setupGlobals(core, github, context, exec, io, getOctokit);
  1682. const { main } = require(path.join(actionsDir, 'missing_tool.cjs'));
  1683. await main();
  1684. - name: Record incomplete
  1685. id: report_incomplete
  1686. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1687. env:
  1688. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1689. GH_AW_REPORT_INCOMPLETE_CREATE_ISSUE: "true"
  1690. GH_AW_WORKFLOW_NAME: "Issue Triage"
  1691. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-triage.md"
  1692. GH_AW_ENGINE_ID: "codex"
  1693. GH_AW_ENGINE_MODEL: "gpt-5.6-luna"
  1694. with:
  1695. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1696. script: |
  1697. const path = require('path');
  1698. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1699. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1700. setupGlobals(core, github, context, exec, io, getOctokit);
  1701. const { main } = require(path.join(actionsDir, 'report_incomplete_handler.cjs'));
  1702. await main();
  1703. - name: Handle agent failure
  1704. id: handle_agent_failure
  1705. if: always()
  1706. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1707. env:
  1708. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1709. GH_AW_WORKFLOW_NAME: "Issue Triage"
  1710. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-triage.md"
  1711. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1712. GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
  1713. GH_AW_WORKFLOW_ID: "issue-triage"
  1714. GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168"
  1715. GH_AW_ENGINE_ID: "codex"
  1716. GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }}
  1717. GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }}
  1718. GH_AW_CHECKOUT_PR_INVALIDATED: ${{ needs.agent.outputs.checkout_pr_invalidated }}
  1719. GH_AW_AI_CREDITS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.ai_credits_rate_limit_error || 'false' }}
  1720. GH_AW_UNKNOWN_MODEL_AI_CREDITS: ${{ needs.agent.outputs.unknown_model_ai_credits || 'false' }}
  1721. GH_AW_AIC: ${{ needs.agent.outputs.aic }}
  1722. GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }}
  1723. GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
  1724. GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_MAX_AI_CREDITS || '1000' }}
  1725. GH_AW_DEFAULT_CHECKOUT_USES_TRIGGER_REF: "true"
  1726. GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
  1727. GH_AW_MCP_POLICY_ERROR: ${{ needs.agent.outputs.mcp_policy_error }}
  1728. GH_AW_AGENTIC_ENGINE_TIMEOUT: ${{ needs.agent.outputs.agentic_engine_timeout }}
  1729. GH_AW_MODEL_NOT_SUPPORTED_ERROR: ${{ needs.agent.outputs.model_not_supported_error }}
  1730. GH_AW_MODEL_ENDPOINT_MISMATCH_ERROR: ${{ needs.agent.outputs.model_endpoint_mismatch_error }}
  1731. GH_AW_HTTP_400_RESPONSE_ERROR: ${{ needs.agent.outputs.http_400_response_error }}
  1732. GH_AW_MAX_CACHE_MISSES_EXCEEDED: ${{ needs.agent.outputs.max_cache_misses_exceeded }}
  1733. GH_AW_MISSING_MODEL_PRICING_ERROR: ${{ needs.agent.outputs.missing_model_pricing_error }}
  1734. GH_AW_MISSING_MODEL_PRICING_MODEL_NAME: ${{ needs.agent.outputs.missing_model_pricing_model_name }}
  1735. GH_AW_SHELL_EXPANSION_GUARD_REJECTED: ${{ needs.agent.outputs.shell_expansion_guard_rejected }}
  1736. GH_AW_ENGINE_API_HOSTS: "ai-pixel.online"
  1737. GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }}
  1738. GH_AW_OAUTH_TOKEN_CHECK_FAILED: ${{ needs.activation.outputs.oauth_token_check_failed }}
  1739. GH_AW_STALE_LOCK_FILE_FAILED: ${{ needs.activation.outputs.stale_lock_file_failed }}
  1740. GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
  1741. GH_AW_DAILY_AI_CREDITS_GUARDRAIL_STATUS: ${{ needs.activation.outputs.daily_ai_credits_guardrail_status }}
  1742. GH_AW_DAILY_AI_CREDITS_GUARDRAIL_ERROR: ${{ needs.activation.outputs.daily_ai_credits_guardrail_error }}
  1743. GH_AW_DAILY_AI_CREDITS_TOTAL: ${{ needs.activation.outputs.daily_ai_credits_total }}
  1744. GH_AW_DAILY_AI_CREDITS_ESTIMATED: ${{ needs.activation.outputs.daily_ai_credits_estimated }}
  1745. GH_AW_DAILY_AI_CREDITS_THRESHOLD: ${{ needs.activation.outputs.daily_ai_credits_threshold }}
  1746. GH_AW_DAILY_AI_CREDITS_CONTINUE_ON_ERROR: "false"
  1747. GH_AW_GROUP_REPORTS: "false"
  1748. GH_AW_FAILURE_REPORT_AS_ISSUE: "true"
  1749. GH_AW_MISSING_TOOL_REPORT_AS_FAILURE: "true"
  1750. GH_AW_MISSING_DATA_REPORT_AS_FAILURE: "true"
  1751. GH_AW_TIMEOUT_MINUTES: "5"
  1752. with:
  1753. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1754. script: |
  1755. const path = require('path');
  1756. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1757. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1758. setupGlobals(core, github, context, exec, io, getOctokit);
  1759. const { main } = require(path.join(actionsDir, 'handle_agent_failure.cjs'));
  1760. await main();
  1761. - name: Report failed jobs
  1762. id: report_failed_jobs
  1763. if: always()
  1764. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1765. env:
  1766. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1767. GH_AW_WORKFLOW_NAME: "Issue Triage"
  1768. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-triage.md"
  1769. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1770. GH_AW_REPORT_FAILED_JOBS: "true"
  1771. with:
  1772. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1773. script: |
  1774. const path = require('path');
  1775. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1776. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1777. setupGlobals(core, github, context, exec, io, getOctokit);
  1778. const { main } = require(path.join(actionsDir, 'report_failed_jobs.cjs'));
  1779. await main();
  1780. - name: Collect usage artifact files
  1781. if: always()
  1782. continue-on-error: true
  1783. env:
  1784. GH_AW_DETECTION_JOB_RESULT: ${{ needs.detection.result }}
  1785. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  1786. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  1787. run: bash "${RUNNER_TEMP}/gh-aw/actions/collect_usage_artifact_files.sh"
  1788. - name: Generate usage activity summary and unified session
  1789. if: always()
  1790. continue-on-error: true
  1791. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1792. env:
  1793. GH_AW_GRADER_MANIFEST_0: '{"version":2,"graders":[]}'
  1794. GH_AW_GRADER_MANIFEST_CHUNKS: '1'
  1795. GH_AW_JOB_DURATIONS: ${{ steps.report_failed_jobs.outputs.job_durations }}
  1796. GH_AW_DAILY_AI_CREDITS_GUARDRAIL_STATUS: ${{ needs.activation.outputs.daily_ai_credits_guardrail_status }}
  1797. GH_AW_DAILY_AI_CREDITS_EXCEEDED: ${{ needs.activation.outputs.daily_ai_credits_exceeded }}
  1798. GH_AW_DAILY_AI_CREDITS_TOTAL: ${{ needs.activation.outputs.daily_ai_credits_total }}
  1799. GH_AW_DAILY_AI_CREDITS_ESTIMATED: ${{ needs.activation.outputs.daily_ai_credits_estimated }}
  1800. GH_AW_DAILY_AI_CREDITS_THRESHOLD: ${{ needs.activation.outputs.daily_ai_credits_threshold }}
  1801. with:
  1802. script: |
  1803. const path = require('path');
  1804. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  1805. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  1806. setupGlobals(core, github, context, exec, io, getOctokit);
  1807. const { main } = require(path.join(actionsDir, 'generate_usage_artifacts.cjs'));
  1808. await main();
  1809. - name: Upload usage artifact
  1810. id: upload-usage-artifact
  1811. if: always()
  1812. continue-on-error: true
  1813. uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
  1814. with:
  1815. name: usage
  1816. path: |
  1817. /tmp/gh-aw/usage/aw_session.jsonl
  1818. /tmp/gh-aw/usage/aw_info.json
  1819. /tmp/gh-aw/usage/aw-info.jsonl
  1820. /tmp/gh-aw/usage/agent_usage.json
  1821. /tmp/gh-aw/usage/agent_usage.jsonl
  1822. /tmp/gh-aw/usage/detection_usage.jsonl
  1823. /tmp/gh-aw/usage/evals.jsonl
  1824. /tmp/gh-aw/usage/graders/grader_manifest.json
  1825. /tmp/gh-aw/usage/graders/grader_results.json
  1826. /tmp/gh-aw/usage/github_rate_limits.jsonl
  1827. /tmp/gh-aw/usage/agent/token_usage.jsonl
  1828. /tmp/gh-aw/usage/agent/model-routing.jsonl
  1829. /tmp/gh-aw/usage/agent/execution.json
  1830. /tmp/gh-aw/usage/agent/harness_retry.json
  1831. /tmp/gh-aw/usage/detection/token_usage.jsonl
  1832. /tmp/gh-aw/usage/detection/execution.json
  1833. /tmp/gh-aw/usage/detection/harness_retry.json
  1834. /tmp/gh-aw/usage/detection/detection_result.json
  1835. /tmp/gh-aw/usage/evals/token_usage.jsonl
  1836. /tmp/gh-aw/usage/evals/execution.json
  1837. /tmp/gh-aw/usage/experiment/state.jsonl
  1838. /tmp/gh-aw/usage/experiment/state.json
  1839. /tmp/gh-aw/usage/experiment/assignments.json
  1840. /tmp/gh-aw/usage/activity/summary.json
  1841. if-no-files-found: ignore
  1842. retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
  1843. - name: Wait before retrying usage artifact upload
  1844. if: always() && steps.upload-usage-artifact.outcome == 'failure'
  1845. run: sleep 10
  1846. - name: Retry upload usage artifact
  1847. id: upload-usage-artifact-retry
  1848. if: always() && steps.upload-usage-artifact.outcome == 'failure'
  1849. continue-on-error: true
  1850. uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
  1851. with:
  1852. name: usage
  1853. path: |
  1854. /tmp/gh-aw/usage/aw_session.jsonl
  1855. /tmp/gh-aw/usage/aw_info.json
  1856. /tmp/gh-aw/usage/aw-info.jsonl
  1857. /tmp/gh-aw/usage/agent_usage.json
  1858. /tmp/gh-aw/usage/agent_usage.jsonl
  1859. /tmp/gh-aw/usage/detection_usage.jsonl
  1860. /tmp/gh-aw/usage/evals.jsonl
  1861. /tmp/gh-aw/usage/graders/grader_manifest.json
  1862. /tmp/gh-aw/usage/graders/grader_results.json
  1863. /tmp/gh-aw/usage/github_rate_limits.jsonl
  1864. /tmp/gh-aw/usage/agent/token_usage.jsonl
  1865. /tmp/gh-aw/usage/agent/model-routing.jsonl
  1866. /tmp/gh-aw/usage/agent/execution.json
  1867. /tmp/gh-aw/usage/agent/harness_retry.json
  1868. /tmp/gh-aw/usage/detection/token_usage.jsonl
  1869. /tmp/gh-aw/usage/detection/execution.json
  1870. /tmp/gh-aw/usage/detection/harness_retry.json
  1871. /tmp/gh-aw/usage/detection/detection_result.json
  1872. /tmp/gh-aw/usage/evals/token_usage.jsonl
  1873. /tmp/gh-aw/usage/evals/execution.json
  1874. /tmp/gh-aw/usage/experiment/state.jsonl
  1875. /tmp/gh-aw/usage/experiment/state.json
  1876. /tmp/gh-aw/usage/experiment/assignments.json
  1877. /tmp/gh-aw/usage/activity/summary.json
  1878. if-no-files-found: ignore
  1879. overwrite: true
  1880. retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
  1881. detection:
  1882. name: detection
  1883. needs:
  1884. - activation
  1885. - agent
  1886. if: always() && needs.agent.result != 'skipped'
  1887. runs-on: ubuntu-latest
  1888. # Permissions for the detection job (workflow permissions default to none).
  1889. permissions:
  1890. contents: read
  1891. timeout-minutes: 10
  1892. env:
  1893. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  1894. outputs:
  1895. aic: ${{ steps.parse_detection_token_usage.outputs.aic }}
  1896. detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
  1897. detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
  1898. detection_success: ${{ steps.detection_conclusion.outputs.success }}
  1899. run_detection: ${{ steps.detection_guard.outputs.run_detection }}
  1900. steps:
  1901. - name: Setup Scripts
  1902. id: setup
  1903. uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
  1904. with:
  1905. destination: ${{ runner.temp }}/gh-aw/actions
  1906. job-name: ${{ github.job }}
  1907. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1908. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  1909. env:
  1910. GH_AW_SETUP_WORKFLOW_NAME: "Issue Triage"
  1911. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-triage.lock.yml@${{ github.ref }}
  1912. GH_AW_INFO_VERSION: "0.164.0"
  1913. GH_AW_INFO_AWF_VERSION: "v0.29.0"
  1914. GH_AW_INFO_ENGINE_ID: "codex"
  1915. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  1916. - name: Download activation artifact
  1917. continue-on-error: true
  1918. uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
  1919. with:
  1920. name: activation
  1921. path: /tmp/gh-aw
  1922. - name: Download agent output artifact
  1923. id: download-agent-output
  1924. continue-on-error: true
  1925. uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
  1926. with:
  1927. pattern: "{agent,agent-output-fallback}"
  1928. merge-multiple: true
  1929. path: /tmp/gh-aw/
  1930. - name: Setup agent output environment variable
  1931. id: setup-agent-output-env
  1932. if: steps.download-agent-output.outcome == 'success'
  1933. run: |
  1934. mkdir -p /tmp/gh-aw/
  1935. find "/tmp/gh-aw/" -type f -print
  1936. if [ -f "/tmp/gh-aw/agent_output.json" ]; then
  1937. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1938. fi
  1939. - name: Clear agent token usage
  1940. if: always()
  1941. run: rm -f /tmp/gh-aw/agent_usage.json
  1942. - name: Checkout repository for patch context
  1943. if: needs.agent.outputs.has_patch == 'true'
  1944. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  1945. with:
  1946. persist-credentials: false
  1947. # --- Threat Detection ---
  1948. - name: Initialize detection execution evidence
  1949. run: |
  1950. mkdir -p "/tmp/gh-aw/threat-detection"
  1951. evidence_tmp="/tmp/gh-aw/threat-detection/execution.json.tmp"
  1952. printf '{"version":1,"component":"detection","run_id":%s,"run_attempt":%s,"state":"not_started"}\n' "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" > "$evidence_tmp"
  1953. mv "$evidence_tmp" "/tmp/gh-aw/threat-detection/execution.json"
  1954. - name: Clear inherited Copilot session state
  1955. run: rm -rf /tmp/gh-aw/sandbox/agent/logs/copilot-session-state
  1956. - name: Clean stale firewall files from agent artifact
  1957. run: |
  1958. rm -rf /tmp/gh-aw/sandbox/firewall/logs
  1959. rm -rf /tmp/gh-aw/sandbox/firewall/audit
  1960. - name: Download container images
  1961. run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.29.0@sha256:b14bd399376180b5649a9324be3b50fbfc82bfe8f0c80045840416b5a4e65b96 ghcr.io/github/gh-aw-firewall/api-proxy:0.29.0@sha256:baff00b856a4bdc93bce134928c70af3d3492f2e518757115042040674d56b0b ghcr.io/github/gh-aw-firewall/squid:0.29.0@sha256:6e0cbf7f980beb78b5461563a8164f6439ca959bc93733d5a6b52972e523ed50
  1962. - name: Check if detection needed
  1963. id: detection_guard
  1964. if: always()
  1965. env:
  1966. OUTPUT_TYPES: ${{ needs.agent.outputs.output_types }}
  1967. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1968. run: |
  1969. if [[ -n "$OUTPUT_TYPES" || "$HAS_PATCH" == "true" ]]; then
  1970. echo "run_detection=true" >> "$GITHUB_OUTPUT"
  1971. echo "Detection will run: output_types=$OUTPUT_TYPES, has_patch=$HAS_PATCH"
  1972. else
  1973. echo "run_detection=false" >> "$GITHUB_OUTPUT"
  1974. echo "Detection skipped: no agent outputs or patches to analyze"
  1975. fi
  1976. - name: Clear MCP Config for detection
  1977. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1978. run: |
  1979. rm -f "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json"
  1980. rm -f "$HOME/.copilot/mcp-config.json"
  1981. rm -f "$GITHUB_WORKSPACE/.gemini/settings.json"
  1982. - name: Prepare threat detection files
  1983. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1984. run: |
  1985. bash "${RUNNER_TEMP}/gh-aw/actions/prepare_threat_detection_files.sh"
  1986. - name: Setup threat detection
  1987. id: detection_setup
  1988. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1989. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1990. env:
  1991. WORKFLOW_NAME: "Issue Triage"
  1992. WORKFLOW_DESCRIPTION: "对新打开的 issue 进行分类、打标签,并路由到对应的处理工作流"
  1993. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1994. GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
  1995. GH_AW_DETECTION_SKIP_PROMPT_SUMMARY: "true"
  1996. with:
  1997. script: |
  1998. const path = require('path');
  1999. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  2000. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  2001. setupGlobals(core, github, context, exec, io, getOctokit);
  2002. const { main } = require(path.join(actionsDir, 'setup_threat_detection.cjs'));
  2003. await main();
  2004. - name: Ensure threat-detection directory and log
  2005. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  2006. run: |
  2007. mkdir -p /tmp/gh-aw/threat-detection
  2008. touch /tmp/gh-aw/threat-detection/detection.log
  2009. - name: Install AWF binary
  2010. run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.0 --rootless
  2011. - name: Setup Node.js
  2012. uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
  2013. with:
  2014. node-version: '24'
  2015. package-manager-cache: false
  2016. - name: Install Codex CLI
  2017. run: npm install --ignore-scripts -g @openai/codex@0.164.0
  2018. - name: Prepare Codex config for threat-detect
  2019. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  2020. run: |
  2021. mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config" "/tmp/gh-aw/mcp-config" "/tmp/gh-aw/mcp-config/logs/"
  2022. printf '%s\n' "{\"mcpServers\":{}}" > "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json"
  2023. # Point Codex at the AWF OpenAI proxy and disable websocket startup.
  2024. cat > "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" << GH_AW_CODEX_DETECTION_CONFIG_af28c8b5454431f5_EOF
  2025. model_provider = "openai-proxy"
  2026. [history]
  2027. persistence = "none"
  2028. [model_providers.openai-proxy]
  2029. name = "OpenAI AWF proxy"
  2030. base_url = "http://172.30.0.30:10000"
  2031. api_base = "http://172.30.0.30:10000"
  2032. wss_base = "ws://172.30.0.30:10000"
  2033. env_key = "CODEX_API_KEY"
  2034. wire_api = "responses"
  2035. requires_openai_auth = false
  2036. supports_websockets = false
  2037. GH_AW_CODEX_DETECTION_CONFIG_af28c8b5454431f5_EOF
  2038. cp "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" "/tmp/gh-aw/mcp-config/config.toml"
  2039. chmod 600 "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" "/tmp/gh-aw/mcp-config/config.toml"
  2040. - name: Install threat-detect binary
  2041. id: threat_detect_install
  2042. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  2043. continue-on-error: true
  2044. run: |
  2045. bash "${RUNNER_TEMP}/gh-aw/actions/install_threat_detect_binary.sh" v0.5.3 --artifact-base-url https://github.com/github/gh-aw-threat-detection/releases/download --sha256-amd64 7cfab3bd02717968a0584ddd3790cff22550059e36d6f656c4f35e9d27851009 --sha256-arm64 6f355949af98e7b5527a958ac11431bd7867db45c0191b94c3a205c662181cc6
  2046. - name: Execute threat detection with AWF
  2047. id: detection_agentic_execution
  2048. if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_setup.outcome == 'success' && steps.detection_setup.outputs.ready == 'true' && steps.threat_detect_install.outcome == 'success'
  2049. continue-on-error: true
  2050. timeout-minutes: 10
  2051. env:
  2052. AWF_REFLECT_ENABLED: 1
  2053. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }}
  2054. CODEX_HOME: /tmp/gh-aw/mcp-config
  2055. GH_AW_HARNESS_MAX_RETRIES: 0
  2056. GH_AW_LLM_PROVIDER: openai
  2057. GH_AW_LLM_PROVIDER_EXPLICIT: 1
  2058. GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }}
  2059. GH_AW_MAX_TURNS: ${{ vars.GH_AW_DEFAULT_MAX_TURNS || '' }}
  2060. GH_AW_MCP_CONFIG: ${{ runner.temp }}/gh-aw/mcp-config/config.toml
  2061. GH_AW_MODEL_DETECTION_CODEX: gpt-5.6-luna
  2062. GH_AW_PHASE: detection
  2063. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  2064. GH_AW_VERSION: v1.0.1
  2065. GITHUB_AW: true
  2066. GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
  2067. GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
  2068. GIT_AUTHOR_NAME: github-actions[bot]
  2069. GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
  2070. GIT_COMMITTER_NAME: github-actions[bot]
  2071. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  2072. OPENAI_BASE_URL: https://ai-pixel.online
  2073. RUNNER_TEMP: ${{ runner.temp }}
  2074. 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' }}
  2075. 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) || '' }}
  2076. WORKFLOW_NAME: "Issue Triage"
  2077. WORKFLOW_DESCRIPTION: "对新打开的 issue 进行分类、打标签,并路由到对应的处理工作流"
  2078. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  2079. GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
  2080. run: |
  2081. mkdir -p "/tmp/gh-aw/threat-detection"
  2082. evidence_tmp="/tmp/gh-aw/threat-detection/execution.json.tmp"
  2083. printf '{"version":1,"component":"detection","run_id":%s,"run_attempt":%s,"state":"started"}\n' "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" > "$evidence_tmp"
  2084. mv "$evidence_tmp" "/tmp/gh-aw/threat-detection/execution.json"
  2085. export GH_AW_AWF_EXECUTION_COMPONENT="detection"
  2086. export GH_AW_AWF_EXECUTION_EVIDENCE_FILE="/tmp/gh-aw/threat-detection/execution.json"
  2087. set -o pipefail
  2088. printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt
  2089. (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
  2090. GH_AW_MAX_AI_CREDITS="${GH_AW_MAX_AI_CREDITS:-400}"
  2091. if [[ ! "$GH_AW_MAX_AI_CREDITS" =~ ^[0-9]+$ ]]; then
  2092. GH_AW_MAX_AI_CREDITS="400"
  2093. fi
  2094. if [[ "${GH_AW_ADMISSION_RESULT:-}" == "admitted" && -n "${GH_AW_ADMISSION_MAX_AI_CREDITS:-}" ]]; then
  2095. if [[ ! "$GH_AW_ADMISSION_MAX_AI_CREDITS" =~ ^[1-9][0-9]{0,9}$ ]] || (( GH_AW_ADMISSION_MAX_AI_CREDITS > 2147483647 )); then
  2096. echo "ERR_ADMISSION: Invalid runtime admission allowance." >&2
  2097. exit 1
  2098. fi
  2099. GH_AW_MAX_AI_CREDITS="$GH_AW_ADMISSION_MAX_AI_CREDITS"
  2100. echo "Admission allowance applied (value withheld)."
  2101. else
  2102. echo "No component admission allowance; retaining existing budget policy (value withheld)."
  2103. fi
  2104. unset GH_AW_ADMISSION_RESULT GH_AW_ADMISSION_MAX_AI_CREDITS
  2105. printf '%s\n' "{\"\$schema\":\"https://github.com/github/gh-aw-firewall/releases/download/v0.29.0/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\",\"github.com\",\"host.docker.internal\",\"open.bigmodel.cn\",\"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\"}},\"providers\":{\"openai\":{\"models\":{\"gpt-5.6-luna\":{\"cost\":{\"cache_read\":\"2e-08\",\"cache_write\":\"2.5e-07\",\"input\":\"2e-07\",\"output\":\"1.2e-06\"}}}}},\"models\":{\"agent\":[\"sonnet-6x\",\"gpt-6\",\"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-3.8-flash\":[\"copilot/gemini-3.8*flash*\",\"google/gemini-3.8*flash*\",\"gemini/gemini-3.8*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*\"],\"gpt-6\":[\"copilot/gpt-6*\",\"openai/gpt-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-6\",\"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*\"],\"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.29.0,squid=sha256:6e0cbf7f980beb78b5461563a8164f6439ca959bc93733d5a6b52972e523ed50,agent=sha256:b14bd399376180b5649a9324be3b50fbfc82bfe8f0c80045840416b5a4e65b96,api-proxy=sha256:baff00b856a4bdc93bce134928c70af3d3492f2e518757115042040674d56b0b,cli-proxy=sha256:087a8e4efff8ac62d46e106cd22005c002822b1481fc233097799511be353b5d\",\"agentTimeout\":10},\"logging\":{\"proxyLogsDir\":\"/tmp/gh-aw/sandbox/firewall/logs\",\"auditDir\":\"/tmp/gh-aw/sandbox/firewall/audit\"}}" > "${RUNNER_TEMP}/gh-aw/awf-config.json"
  2106. cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json
  2107. export GH_AW_MODELS_JSON_PATH="/tmp/gh-aw/models.json"
  2108. GH_AW_DOCKER_HOST=""
  2109. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  2110. GH_AW_DOCKER_HOST="${DOCKER_HOST}"
  2111. fi
  2112. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  2113. _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; }
  2114. printf '%s\n' "$_GH_AW_CHROOT_JSON" > "${RUNNER_TEMP}/gh-aw/awf-config.json"
  2115. fi
  2116. GH_AW_TOOL_CACHE_MOUNT=""
  2117. GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"
  2118. if [ -d "$GH_AW_TOOL_CACHE" ]; then
  2119. if [[ "$GH_AW_TOOL_CACHE" != /opt/* ]]; then
  2120. GH_AW_TOOL_CACHE_MOUNT="$GH_AW_TOOL_CACHE:$GH_AW_TOOL_CACHE:ro"
  2121. fi
  2122. fi
  2123. # shellcheck disable=SC1003,SC2016,SC2086
  2124. 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 GH_AW_OTLP_ALL_HEADERS --exclude-env GH_AW_OTLP_ENDPOINTS --exclude-env OPENAI_API_KEY --exclude-env OTEL_EXPORTER_OTLP_ENDPOINT --exclude-env OTEL_EXPORTER_OTLP_HEADERS --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 \
  2125. -- /bin/bash -c 'set +o histexpand; : "${RUNNER_TOOL_CACHE:?RUNNER_TOOL_CACHE must be set}"; GH_AW_TOOL_CACHE="$RUNNER_TOOL_CACHE"; GH_AW_TOOL_BINS="$(find "$GH_AW_TOOL_CACHE" -maxdepth 5 -type d -name bin 2>/dev/null | tr "\n" ":")"; GH_AW_TOOL_BINS="${GH_AW_TOOL_BINS%:}"; export PATH="$PATH${GH_AW_TOOL_BINS:+:}$GH_AW_TOOL_BINS"; [ -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
  2126. - name: Copy detection firewall logs
  2127. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  2128. continue-on-error: true
  2129. run: |
  2130. mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall
  2131. 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
  2132. 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
  2133. - name: Redact secrets in detection logs
  2134. id: redact_detection_logs
  2135. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  2136. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  2137. env:
  2138. GH_AW_SECRET_NAMES: 'CODEX_API_KEY,GH_AW_DEFAULT_OTLP_ENDPOINT,GH_AW_DEFAULT_OTLP_HEADERS,OPENAI_API_KEY,PIXEL_API_KEY'
  2139. SECRET_CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  2140. SECRET_GH_AW_DEFAULT_OTLP_ENDPOINT: ${{ secrets.GH_AW_DEFAULT_OTLP_ENDPOINT }}
  2141. SECRET_GH_AW_DEFAULT_OTLP_HEADERS: ${{ secrets.GH_AW_DEFAULT_OTLP_HEADERS }}
  2142. SECRET_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  2143. SECRET_PIXEL_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  2144. with:
  2145. script: |
  2146. const path = require('path');
  2147. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  2148. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  2149. setupGlobals(core, github, context, exec, io, getOctokit);
  2150. const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
  2151. const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
  2152. await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
  2153. - name: Parse threat detection token usage for step summary
  2154. id: parse_detection_token_usage
  2155. if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success'
  2156. continue-on-error: true
  2157. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  2158. env:
  2159. GH_AW_TOKEN_USAGE_SUMMARY_TITLE: Threat Detection Token Usage
  2160. GH_AW_PHASE: detection
  2161. GH_AW_AGENT_USAGE_PATH: /tmp/gh-aw/threat-detection/detection_usage.json
  2162. GH_AW_AGENT_USAGE_JSONL_PATH: /tmp/gh-aw/threat-detection/detection_usage.jsonl
  2163. GH_AW_WRITE_EMPTY_USAGE: "true"
  2164. with:
  2165. script: |
  2166. const path = require('path');
  2167. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  2168. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  2169. setupGlobals(core, github, context, exec, io, getOctokit);
  2170. const { main } = require(path.join(actionsDir, 'parse_token_usage.cjs'));
  2171. await main();
  2172. - name: Redact secrets in detection artifacts
  2173. id: redact_detection_artifacts
  2174. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  2175. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  2176. env:
  2177. GH_AW_SECRET_NAMES: 'CODEX_API_KEY,GH_AW_DEFAULT_OTLP_ENDPOINT,GH_AW_DEFAULT_OTLP_HEADERS,OPENAI_API_KEY,PIXEL_API_KEY'
  2178. SECRET_CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  2179. SECRET_GH_AW_DEFAULT_OTLP_ENDPOINT: ${{ secrets.GH_AW_DEFAULT_OTLP_ENDPOINT }}
  2180. SECRET_GH_AW_DEFAULT_OTLP_HEADERS: ${{ secrets.GH_AW_DEFAULT_OTLP_HEADERS }}
  2181. SECRET_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  2182. SECRET_PIXEL_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  2183. with:
  2184. script: |
  2185. const path = require('path');
  2186. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  2187. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  2188. setupGlobals(core, github, context, exec, io, getOctokit);
  2189. const { main } = require(path.join(actionsDir, 'redact_secrets.cjs'));
  2190. const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
  2191. await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
  2192. - name: Render detection log
  2193. if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
  2194. continue-on-error: true
  2195. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  2196. with:
  2197. script: |
  2198. const path = require('path');
  2199. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  2200. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  2201. setupGlobals(core, github, context, exec, io, getOctokit);
  2202. const { main } = require(path.join(actionsDir, 'render_detection_log.cjs'));
  2203. await main();
  2204. - name: Upload threat detection artifact
  2205. if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
  2206. uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
  2207. with:
  2208. name: detection
  2209. path: |
  2210. /tmp/gh-aw/threat-detection/detection_result.json
  2211. /tmp/gh-aw/threat-detection/execution.json
  2212. /tmp/gh-aw/threat-detection/detection_usage.json
  2213. /tmp/gh-aw/threat-detection/detection_usage.jsonl
  2214. /tmp/gh-aw/threat-detection/sandbox/firewall/logs/
  2215. /tmp/gh-aw/threat-detection/sandbox/firewall/audit/
  2216. if-no-files-found: ignore
  2217. retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
  2218. - name: Conclude threat detection
  2219. id: detection_conclusion
  2220. if: always() && steps.detection_guard.outputs.run_detection == 'false' || (always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success')
  2221. continue-on-error: true
  2222. env:
  2223. RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
  2224. DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
  2225. THREAT_DETECT_INSTALL_OUTCOME: ${{ steps.threat_detect_install.outcome }}
  2226. GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
  2227. run: |
  2228. bash "${RUNNER_TEMP}/gh-aw/actions/conclude_threat_detection.sh" /tmp/gh-aw/threat-detection/detection_result.json
  2229. - name: Upload skipped detection execution evidence
  2230. if: always() && steps.detection_guard.outputs.run_detection == 'false'
  2231. uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
  2232. with:
  2233. name: detection
  2234. path: /tmp/gh-aw/threat-detection/execution.json
  2235. if-no-files-found: ignore
  2236. retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
  2237. safe_outputs:
  2238. name: safe_outputs
  2239. needs:
  2240. - activation
  2241. - agent
  2242. - detection
  2243. if: (!cancelled()) && needs.agent.result != 'skipped' && needs.detection.result == 'success'
  2244. runs-on: ubuntu-slim
  2245. # Permissions for the safe_outputs job (workflow permissions default to none).
  2246. permissions:
  2247. issues: write
  2248. pull-requests: write
  2249. timeout-minutes: 15
  2250. env:
  2251. GH_AW_AGENT_AIC: ${{ needs.agent.outputs.aic }}
  2252. GH_AW_AIC: ${{ needs.agent.outputs.aic }}
  2253. GH_AW_AMBIENT_CONTEXT: ${{ needs.agent.outputs.ambient_context }}
  2254. GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/issue-triage"
  2255. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  2256. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  2257. GH_AW_ENGINE_ID: "codex"
  2258. GH_AW_ENGINE_MODEL: "gpt-5.6-luna"
  2259. GH_AW_RUNTIME_FEATURES: ${{ vars.GH_AW_RUNTIME_FEATURES }}
  2260. GH_AW_RUN_DETECTION: ${{ needs.detection.outputs.run_detection }}
  2261. GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }}
  2262. GH_AW_WORKFLOW_ID: "issue-triage"
  2263. GH_AW_WORKFLOW_NAME: "Issue Triage"
  2264. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/issue-triage.md"
  2265. outputs:
  2266. call_workflow_name: ${{ steps.process_safe_outputs.outputs.call_workflow_name }}
  2267. call_workflow_payload: ${{ steps.process_safe_outputs.outputs.call_workflow_payload }}
  2268. code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }}
  2269. code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }}
  2270. comment_id: ${{ steps.process_safe_outputs.outputs.comment_id }}
  2271. comment_url: ${{ steps.process_safe_outputs.outputs.comment_url }}
  2272. create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }}
  2273. create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }}
  2274. process_safe_outputs_items_applied: ${{ steps.process_safe_outputs.outputs.items_applied }}
  2275. process_safe_outputs_items_cancelled: ${{ steps.process_safe_outputs.outputs.items_cancelled }}
  2276. process_safe_outputs_items_deferred: ${{ steps.process_safe_outputs.outputs.items_deferred }}
  2277. process_safe_outputs_items_failed: ${{ steps.process_safe_outputs.outputs.items_failed }}
  2278. process_safe_outputs_items_skipped: ${{ steps.process_safe_outputs.outputs.items_skipped }}
  2279. process_safe_outputs_items_succeeded: ${{ steps.process_safe_outputs.outputs.items_succeeded }}
  2280. process_safe_outputs_items_warnings: ${{ steps.process_safe_outputs.outputs.items_warnings }}
  2281. process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }}
  2282. process_safe_outputs_status: ${{ steps.process_safe_outputs.outputs.status }}
  2283. steps:
  2284. - name: Setup Scripts
  2285. id: setup
  2286. uses: github/gh-aw-actions/setup@221ba4f4319de6b8e809d1a15528b3ae6a818aa5 # v1.0.1
  2287. with:
  2288. destination: ${{ runner.temp }}/gh-aw/actions
  2289. job-name: ${{ github.job }}
  2290. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  2291. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  2292. env:
  2293. GH_AW_SETUP_WORKFLOW_NAME: "Issue Triage"
  2294. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-triage.lock.yml@${{ github.ref }}
  2295. GH_AW_INFO_VERSION: "0.164.0"
  2296. GH_AW_INFO_AWF_VERSION: "v0.29.0"
  2297. GH_AW_INFO_ENGINE_ID: "codex"
  2298. GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
  2299. - name: Mask OTLP telemetry headers
  2300. run: bash "${RUNNER_TEMP}/gh-aw/actions/mask_otlp_headers.sh"
  2301. - name: Download agent output artifact
  2302. id: download-agent-output
  2303. continue-on-error: true
  2304. uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
  2305. with:
  2306. pattern: "{agent,agent-output-fallback}"
  2307. merge-multiple: true
  2308. path: /tmp/gh-aw/
  2309. - name: Setup agent output environment variable
  2310. id: setup-agent-output-env
  2311. if: steps.download-agent-output.outcome == 'success'
  2312. run: |
  2313. mkdir -p /tmp/gh-aw/
  2314. find "/tmp/gh-aw/" -type f -print
  2315. if [ -f "/tmp/gh-aw/agent_output.json" ]; then
  2316. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  2317. fi
  2318. - name: Configure GH_HOST for enterprise compatibility
  2319. id: ghes-host-config
  2320. shell: bash
  2321. run: | # zizmor: ignore[github-env] - GITHUB_SERVER_URL is set by GitHub Actions, not user input.
  2322. # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct
  2323. # GitHub instance (GHES/GHEC). On github.com this is a harmless no-op.
  2324. GH_HOST="${GITHUB_SERVER_URL#https://}"
  2325. GH_HOST="${GH_HOST#http://}"
  2326. echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV"
  2327. - name: Process Safe Outputs
  2328. id: process_safe_outputs
  2329. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  2330. env:
  2331. GH_AW_JOB_CHECK_RUN_ID: ${{ job.check_run_id }}
  2332. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  2333. GH_AW_COMMENT_ID: ${{ needs.activation.outputs.comment_id }}
  2334. GH_AW_MENTIONS_GITHUB_TOKEN: ${{ github.token }}
  2335. 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"
  2336. GITHUB_SERVER_URL: ${{ github.server_url }}
  2337. GITHUB_API_URL: ${{ github.api_url }}
  2338. 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\":{},\"noop\":{\"max\":2,\"report-as-issue\":\"false\"},\"report_incomplete\":{},\"report_missing_data\":{},\"report_missing_tool\":{}}"
  2339. GH_AW_GITHUB_TOKEN_SOURCE: ${{ secrets.GH_AW_GITHUB_TOKEN != '' && 'pat' || 'github_actions' }}
  2340. with:
  2341. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  2342. script: |
  2343. const path = require('path');
  2344. const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
  2345. const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));
  2346. setupGlobals(core, github, context, exec, io, getOctokit, process.env.GH_AW_GITHUB_TOKEN_SOURCE);
  2347. const { main } = require(path.join(actionsDir, 'process_safe_outputs.cjs'));
  2348. await main();
  2349. - name: Upload Safe Outputs Items
  2350. if: always()
  2351. uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
  2352. with:
  2353. name: safe-outputs-items
  2354. path: |
  2355. /tmp/gh-aw/safe-output-items.jsonl
  2356. /tmp/gh-aw/safe-output-outcomes.jsonl
  2357. /tmp/gh-aw/temporary-id-map.json
  2358. /tmp/gh-aw/safe-output-errors.json
  2359. if-no-files-found: ignore
  2360. retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}