pr-review-intent.lock.yml 120 KB

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