pr-review-intent.lock.yml 141 KB

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