pr-review-intent.lock.yml 124 KB

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