pr-review-intent.lock.yml 114 KB

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