pr-review-intent.lock.yml 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222
  1. # gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"4f9b09824c761259df93e85198cddc36d679de09d9367d090d1f80b30ad39ae7","compiler_version":"v0.68.3","strict":true,"agent_id":"codex","agent_model":"gpt-5.4"}
  2. # gh-aw-manifest: {"version":1,"secrets":["CODEX_API_KEY","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN","OPENAI_API_KEY","PIXEL_API_KEY"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"373c709c69115d41ff229c7e5df9f8788daa9553","version":"v9"},{"repo":"actions/setup-node","sha":"53b83947a5a98c8d113130e565377fae1a50d02f","version":"v6.3.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"ba90f2186d7ad780ec640f364005fa24e797b360","version":"v0.68.3"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.20"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.20"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.2.19"},{"image":"ghcr.io/github/github-mcp-server:v0.32.0"},{"image":"node:lts-alpine"}]}
  3. # ___ _ _
  4. # / _ \ | | (_)
  5. # | |_| | __ _ ___ _ __ | |_ _ ___
  6. # | _ |/ _` |/ _ \ '_ \| __| |/ __|
  7. # | | | | (_| | __/ | | | |_| | (__
  8. # \_| |_/\__, |\___|_| |_|\__|_|\___|
  9. # __/ |
  10. # _ _ |___/
  11. # | | | | / _| |
  12. # | | | | ___ _ __ _ __| |_| | _____ ____
  13. # | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___|
  14. # \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \
  15. # \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/
  16. #
  17. # This file was automatically generated by gh-aw (v0.68.3). DO NOT EDIT.
  18. #
  19. # To update this file, edit the corresponding .md file and run:
  20. # gh aw compile
  21. # Not all edits will cause changes to this file.
  22. #
  23. # For more information: https://github.github.com/gh-aw/introduction/overview/
  24. #
  25. # 自动审计 Pull Request 的代码意图、隐含约束、实现对齐情况与发布风险
  26. #
  27. # Resolved workflow manifest:
  28. # Imports:
  29. # - shared/engine.md
  30. # - shared/network.md
  31. #
  32. # Secrets used:
  33. # - CODEX_API_KEY
  34. # - GH_AW_GITHUB_MCP_SERVER_TOKEN
  35. # - GH_AW_GITHUB_TOKEN
  36. # - GITHUB_TOKEN
  37. # - OPENAI_API_KEY
  38. # - PIXEL_API_KEY
  39. #
  40. # Custom actions used:
  41. # - actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  42. # - actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  43. # - actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  44. # - actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
  45. # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  46. # - github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  47. #
  48. # Container images used:
  49. # - ghcr.io/github/gh-aw-firewall/agent:0.25.20
  50. # - ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20
  51. # - ghcr.io/github/gh-aw-firewall/squid:0.25.20
  52. # - ghcr.io/github/gh-aw-mcpg:v0.2.19
  53. # - ghcr.io/github/github-mcp-server:v0.32.0
  54. # - node:lts-alpine
  55. name: "PR Review Intent"
  56. "on":
  57. pull_request_target:
  58. branches:
  59. - dev
  60. types:
  61. - opened
  62. - reopened
  63. # roles: all # Roles processed as role check in pre-activation job
  64. permissions: {}
  65. concurrency:
  66. group: "gh-aw-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref || github.run_id }}"
  67. cancel-in-progress: true
  68. run-name: "PR Review Intent"
  69. jobs:
  70. activation:
  71. runs-on: ubuntu-slim
  72. permissions:
  73. actions: read
  74. contents: read
  75. outputs:
  76. body: ${{ steps.sanitized.outputs.body }}
  77. comment_id: ""
  78. comment_repo: ""
  79. lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }}
  80. model: ${{ steps.generate_aw_info.outputs.model }}
  81. secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }}
  82. setup-trace-id: ${{ steps.setup.outputs.trace-id }}
  83. stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }}
  84. text: ${{ steps.sanitized.outputs.text }}
  85. title: ${{ steps.sanitized.outputs.title }}
  86. steps:
  87. - name: Setup Scripts
  88. id: setup
  89. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  90. with:
  91. destination: ${{ runner.temp }}/gh-aw/actions
  92. job-name: ${{ github.job }}
  93. - name: Generate agentic run info
  94. id: generate_aw_info
  95. env:
  96. GH_AW_INFO_ENGINE_ID: "codex"
  97. GH_AW_INFO_ENGINE_NAME: "Codex"
  98. GH_AW_INFO_MODEL: "gpt-5.4"
  99. GH_AW_INFO_VERSION: "0.118.0"
  100. GH_AW_INFO_AGENT_VERSION: "0.118.0"
  101. GH_AW_INFO_CLI_VERSION: "v0.68.3"
  102. GH_AW_INFO_WORKFLOW_NAME: "PR Review Intent"
  103. GH_AW_INFO_EXPERIMENTAL: "false"
  104. GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true"
  105. GH_AW_INFO_STAGED: "false"
  106. 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"]'
  107. GH_AW_INFO_FIREWALL_ENABLED: "true"
  108. GH_AW_INFO_AWF_VERSION: "v0.25.20"
  109. GH_AW_INFO_AWMG_VERSION: ""
  110. GH_AW_INFO_FIREWALL_TYPE: "squid"
  111. GH_AW_COMPILED_STRICT: "true"
  112. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  113. with:
  114. script: |
  115. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  116. setupGlobals(core, github, context, exec, io, getOctokit);
  117. const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_aw_info.cjs');
  118. await main(core, context);
  119. - name: Validate CODEX_API_KEY or OPENAI_API_KEY secret
  120. id: validate-secret
  121. 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
  122. env:
  123. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  124. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  125. - name: Checkout .github and .agents folders
  126. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  127. with:
  128. persist-credentials: false
  129. sparse-checkout: |
  130. .github
  131. .agents
  132. sparse-checkout-cone-mode: true
  133. fetch-depth: 1
  134. - name: Check workflow lock file
  135. id: check-lock-file
  136. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  137. env:
  138. GH_AW_WORKFLOW_FILE: "pr-review-intent.lock.yml"
  139. GH_AW_CONTEXT_WORKFLOW_REF: "${{ github.workflow_ref }}"
  140. with:
  141. script: |
  142. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  143. setupGlobals(core, github, context, exec, io, getOctokit);
  144. const { main } = require('${{ runner.temp }}/gh-aw/actions/check_workflow_timestamp_api.cjs');
  145. await main();
  146. - name: Check compile-agentic version
  147. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  148. env:
  149. GH_AW_COMPILED_VERSION: "v0.68.3"
  150. with:
  151. script: |
  152. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  153. setupGlobals(core, github, context, exec, io, getOctokit);
  154. const { main } = require('${{ runner.temp }}/gh-aw/actions/check_version_updates.cjs');
  155. await main();
  156. - name: Compute current body text
  157. id: sanitized
  158. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  159. with:
  160. script: |
  161. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  162. setupGlobals(core, github, context, exec, io, getOctokit);
  163. const { main } = require('${{ runner.temp }}/gh-aw/actions/compute_text.cjs');
  164. await main();
  165. - name: Create prompt with built-in context
  166. env:
  167. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  168. GH_AW_SAFE_OUTPUTS: ${{ runner.temp }}/gh-aw/safeoutputs/outputs.jsonl
  169. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  170. GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }}
  171. GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }}
  172. GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
  173. GH_AW_GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
  174. GH_AW_GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
  175. GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
  176. GH_AW_GITHUB_EVENT_PULL_REQUEST_TITLE: ${{ github.event.pull_request.title }}
  177. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  178. GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
  179. GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
  180. # poutine:ignore untrusted_checkout_exec
  181. run: |
  182. bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh"
  183. {
  184. cat << 'GH_AW_PROMPT_87d99ff0afb97664_EOF'
  185. <system>
  186. GH_AW_PROMPT_87d99ff0afb97664_EOF
  187. cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md"
  188. cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md"
  189. cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md"
  190. cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md"
  191. cat << 'GH_AW_PROMPT_87d99ff0afb97664_EOF'
  192. <safe-output-tools>
  193. Tools: add_comment, missing_tool, missing_data, noop
  194. </safe-output-tools>
  195. <github-context>
  196. The following GitHub context information is available for this workflow:
  197. {{#if __GH_AW_GITHUB_ACTOR__ }}
  198. - **actor**: __GH_AW_GITHUB_ACTOR__
  199. {{/if}}
  200. {{#if __GH_AW_GITHUB_REPOSITORY__ }}
  201. - **repository**: __GH_AW_GITHUB_REPOSITORY__
  202. {{/if}}
  203. {{#if __GH_AW_GITHUB_WORKSPACE__ }}
  204. - **workspace**: __GH_AW_GITHUB_WORKSPACE__
  205. {{/if}}
  206. {{#if __GH_AW_GITHUB_EVENT_ISSUE_NUMBER__ }}
  207. - **issue-number**: #__GH_AW_GITHUB_EVENT_ISSUE_NUMBER__
  208. {{/if}}
  209. {{#if __GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER__ }}
  210. - **discussion-number**: #__GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER__
  211. {{/if}}
  212. {{#if __GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__ }}
  213. - **pull-request-number**: #__GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__
  214. {{/if}}
  215. {{#if __GH_AW_GITHUB_EVENT_COMMENT_ID__ }}
  216. - **comment-id**: __GH_AW_GITHUB_EVENT_COMMENT_ID__
  217. {{/if}}
  218. {{#if __GH_AW_GITHUB_RUN_ID__ }}
  219. - **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__
  220. {{/if}}
  221. </github-context>
  222. GH_AW_PROMPT_87d99ff0afb97664_EOF
  223. cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md"
  224. cat << 'GH_AW_PROMPT_87d99ff0afb97664_EOF'
  225. </system>
  226. {{#runtime-import .github/workflows/shared/engine.md}}
  227. {{#runtime-import .github/workflows/shared/network.md}}
  228. {{#runtime-import .github/workflows/pr-review-intent.md}}
  229. GH_AW_PROMPT_87d99ff0afb97664_EOF
  230. } > "$GH_AW_PROMPT"
  231. - name: Interpolate variables and render templates
  232. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  233. env:
  234. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  235. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  236. GH_AW_GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
  237. GH_AW_GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
  238. GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
  239. GH_AW_GITHUB_EVENT_PULL_REQUEST_TITLE: ${{ github.event.pull_request.title }}
  240. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  241. with:
  242. script: |
  243. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  244. setupGlobals(core, github, context, exec, io, getOctokit);
  245. const { main } = require('${{ runner.temp }}/gh-aw/actions/interpolate_prompt.cjs');
  246. await main();
  247. - name: Substitute placeholders
  248. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  249. env:
  250. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  251. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  252. GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }}
  253. GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }}
  254. GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
  255. GH_AW_GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
  256. GH_AW_GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
  257. GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
  258. GH_AW_GITHUB_EVENT_PULL_REQUEST_TITLE: ${{ github.event.pull_request.title }}
  259. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  260. GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
  261. GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
  262. with:
  263. script: |
  264. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  265. setupGlobals(core, github, context, exec, io, getOctokit);
  266. const substitutePlaceholders = require('${{ runner.temp }}/gh-aw/actions/substitute_placeholders.cjs');
  267. // Call the substitution function
  268. return await substitutePlaceholders({
  269. file: process.env.GH_AW_PROMPT,
  270. substitutions: {
  271. GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR,
  272. GH_AW_GITHUB_EVENT_COMMENT_ID: process.env.GH_AW_GITHUB_EVENT_COMMENT_ID,
  273. GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: process.env.GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER,
  274. GH_AW_GITHUB_EVENT_ISSUE_NUMBER: process.env.GH_AW_GITHUB_EVENT_ISSUE_NUMBER,
  275. GH_AW_GITHUB_EVENT_PULL_REQUEST_BASE_SHA: process.env.GH_AW_GITHUB_EVENT_PULL_REQUEST_BASE_SHA,
  276. GH_AW_GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: process.env.GH_AW_GITHUB_EVENT_PULL_REQUEST_HEAD_SHA,
  277. GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: process.env.GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER,
  278. GH_AW_GITHUB_EVENT_PULL_REQUEST_TITLE: process.env.GH_AW_GITHUB_EVENT_PULL_REQUEST_TITLE,
  279. GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY,
  280. GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID,
  281. GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE
  282. }
  283. });
  284. - name: Validate prompt placeholders
  285. env:
  286. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  287. # poutine:ignore untrusted_checkout_exec
  288. run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_prompt_placeholders.sh"
  289. - name: Print prompt
  290. env:
  291. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  292. # poutine:ignore untrusted_checkout_exec
  293. run: bash "${RUNNER_TEMP}/gh-aw/actions/print_prompt_summary.sh"
  294. - name: Upload activation artifact
  295. if: success()
  296. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  297. with:
  298. name: activation
  299. path: |
  300. /tmp/gh-aw/aw_info.json
  301. /tmp/gh-aw/aw-prompts/prompt.txt
  302. /tmp/gh-aw/github_rate_limits.jsonl
  303. if-no-files-found: ignore
  304. retention-days: 1
  305. agent:
  306. needs: activation
  307. runs-on: ubuntu-latest
  308. permissions:
  309. checks: read
  310. contents: read
  311. issues: read
  312. pull-requests: read
  313. statuses: read
  314. env:
  315. DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
  316. GH_AW_ASSETS_ALLOWED_EXTS: ""
  317. GH_AW_ASSETS_BRANCH: ""
  318. GH_AW_ASSETS_MAX_SIZE_KB: 0
  319. GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs
  320. GH_AW_WORKFLOW_ID_SANITIZED: prreviewintent
  321. outputs:
  322. checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }}
  323. effective_tokens: ${{ steps.parse-mcp-gateway.outputs.effective_tokens }}
  324. has_patch: ${{ steps.collect_output.outputs.has_patch }}
  325. model: ${{ needs.activation.outputs.model }}
  326. output: ${{ steps.collect_output.outputs.output }}
  327. output_types: ${{ steps.collect_output.outputs.output_types }}
  328. setup-trace-id: ${{ steps.setup.outputs.trace-id }}
  329. steps:
  330. - name: Setup Scripts
  331. id: setup
  332. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  333. with:
  334. destination: ${{ runner.temp }}/gh-aw/actions
  335. job-name: ${{ github.job }}
  336. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  337. - name: Set runtime paths
  338. id: set-runtime-paths
  339. run: |
  340. {
  341. echo "GH_AW_SAFE_OUTPUTS=${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl"
  342. echo "GH_AW_SAFE_OUTPUTS_CONFIG_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/config.json"
  343. echo "GH_AW_SAFE_OUTPUTS_TOOLS_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/tools.json"
  344. } >> "$GITHUB_OUTPUT"
  345. - name: Checkout repository
  346. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  347. with:
  348. persist-credentials: false
  349. - name: Create gh-aw temp directory
  350. run: bash "${RUNNER_TEMP}/gh-aw/actions/create_gh_aw_tmp_dir.sh"
  351. - name: Configure gh CLI for GitHub Enterprise
  352. run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_gh_for_ghe.sh"
  353. env:
  354. GH_TOKEN: ${{ github.token }}
  355. - name: Configure Git credentials
  356. env:
  357. REPO_NAME: ${{ github.repository }}
  358. SERVER_URL: ${{ github.server_url }}
  359. GITHUB_TOKEN: ${{ github.token }}
  360. run: |
  361. git config --global user.email "github-actions[bot]@users.noreply.github.com"
  362. git config --global user.name "github-actions[bot]"
  363. git config --global am.keepcr true
  364. # Re-authenticate git with GitHub token
  365. SERVER_URL_STRIPPED="${SERVER_URL#https://}"
  366. git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
  367. echo "Git configured with standard GitHub Actions identity"
  368. - name: Checkout PR branch
  369. id: checkout-pr
  370. if: |
  371. github.event.pull_request || github.event.issue.pull_request
  372. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  373. env:
  374. GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  375. with:
  376. github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  377. script: |
  378. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  379. setupGlobals(core, github, context, exec, io, getOctokit);
  380. const { main } = require('${{ runner.temp }}/gh-aw/actions/checkout_pr_branch.cjs');
  381. await main();
  382. - name: Setup Node.js
  383. uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
  384. with:
  385. node-version: '24'
  386. package-manager-cache: false
  387. - name: Install Codex CLI
  388. run: npm install --ignore-scripts -g @openai/codex@0.118.0
  389. - name: Install AWF binary
  390. run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.20
  391. - name: Parse integrity filter lists
  392. id: parse-guard-vars
  393. env:
  394. GH_AW_BLOCKED_USERS_VAR: ${{ vars.GH_AW_GITHUB_BLOCKED_USERS || '' }}
  395. GH_AW_TRUSTED_USERS_VAR: ${{ vars.GH_AW_GITHUB_TRUSTED_USERS || '' }}
  396. GH_AW_APPROVAL_LABELS_VAR: ${{ vars.GH_AW_GITHUB_APPROVAL_LABELS || '' }}
  397. run: bash "${RUNNER_TEMP}/gh-aw/actions/parse_guard_list.sh"
  398. - name: Download container images
  399. run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.20 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20 ghcr.io/github/gh-aw-firewall/squid:0.25.20 ghcr.io/github/gh-aw-mcpg:v0.2.19 ghcr.io/github/github-mcp-server:v0.32.0 node:lts-alpine
  400. - name: Write Safe Outputs Config
  401. run: |
  402. mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs"
  403. mkdir -p /tmp/gh-aw/safeoutputs
  404. mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs
  405. cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_c9f856230444f12e_EOF'
  406. {"add_comment":{"max":1,"target":"triggering"},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}}
  407. GH_AW_SAFE_OUTPUTS_CONFIG_c9f856230444f12e_EOF
  408. - name: Write Safe Outputs Tools
  409. env:
  410. GH_AW_TOOLS_META_JSON: |
  411. {
  412. "description_suffixes": {
  413. "add_comment": " CONSTRAINTS: Maximum 1 comment(s) can be added. Target: triggering. Supports reply_to_id for discussion threading."
  414. },
  415. "repo_params": {},
  416. "dynamic_tools": []
  417. }
  418. GH_AW_VALIDATION_JSON: |
  419. {
  420. "add_comment": {
  421. "defaultMax": 1,
  422. "fields": {
  423. "body": {
  424. "required": true,
  425. "type": "string",
  426. "sanitize": true,
  427. "maxLength": 65000
  428. },
  429. "item_number": {
  430. "issueOrPRNumber": true
  431. },
  432. "reply_to_id": {
  433. "type": "string",
  434. "maxLength": 256
  435. },
  436. "repo": {
  437. "type": "string",
  438. "maxLength": 256
  439. }
  440. }
  441. },
  442. "missing_data": {
  443. "defaultMax": 20,
  444. "fields": {
  445. "alternatives": {
  446. "type": "string",
  447. "sanitize": true,
  448. "maxLength": 256
  449. },
  450. "context": {
  451. "type": "string",
  452. "sanitize": true,
  453. "maxLength": 256
  454. },
  455. "data_type": {
  456. "type": "string",
  457. "sanitize": true,
  458. "maxLength": 128
  459. },
  460. "reason": {
  461. "type": "string",
  462. "sanitize": true,
  463. "maxLength": 256
  464. }
  465. }
  466. },
  467. "missing_tool": {
  468. "defaultMax": 20,
  469. "fields": {
  470. "alternatives": {
  471. "type": "string",
  472. "sanitize": true,
  473. "maxLength": 512
  474. },
  475. "reason": {
  476. "required": true,
  477. "type": "string",
  478. "sanitize": true,
  479. "maxLength": 256
  480. },
  481. "tool": {
  482. "type": "string",
  483. "sanitize": true,
  484. "maxLength": 128
  485. }
  486. }
  487. },
  488. "noop": {
  489. "defaultMax": 1,
  490. "fields": {
  491. "message": {
  492. "required": true,
  493. "type": "string",
  494. "sanitize": true,
  495. "maxLength": 65000
  496. }
  497. }
  498. },
  499. "report_incomplete": {
  500. "defaultMax": 5,
  501. "fields": {
  502. "details": {
  503. "type": "string",
  504. "sanitize": true,
  505. "maxLength": 65000
  506. },
  507. "reason": {
  508. "required": true,
  509. "type": "string",
  510. "sanitize": true,
  511. "maxLength": 1024
  512. }
  513. }
  514. }
  515. }
  516. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  517. with:
  518. script: |
  519. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  520. setupGlobals(core, github, context, exec, io, getOctokit);
  521. const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_safe_outputs_tools.cjs');
  522. await main();
  523. - name: Generate Safe Outputs MCP Server Config
  524. id: safe-outputs-config
  525. run: |
  526. # Generate a secure random API key (360 bits of entropy, 40+ chars)
  527. # Mask immediately to prevent timing vulnerabilities
  528. API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
  529. echo "::add-mask::${API_KEY}"
  530. PORT=3001
  531. # Set outputs for next steps
  532. {
  533. echo "safe_outputs_api_key=${API_KEY}"
  534. echo "safe_outputs_port=${PORT}"
  535. } >> "$GITHUB_OUTPUT"
  536. echo "Safe Outputs MCP server will run on port ${PORT}"
  537. - name: Start Safe Outputs MCP HTTP Server
  538. id: safe-outputs-start
  539. env:
  540. DEBUG: '*'
  541. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  542. GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-config.outputs.safe_outputs_port }}
  543. GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-config.outputs.safe_outputs_api_key }}
  544. GH_AW_SAFE_OUTPUTS_TOOLS_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/tools.json
  545. GH_AW_SAFE_OUTPUTS_CONFIG_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/config.json
  546. GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs
  547. run: |
  548. # Environment variables are set above to prevent template injection
  549. export DEBUG
  550. export GH_AW_SAFE_OUTPUTS
  551. export GH_AW_SAFE_OUTPUTS_PORT
  552. export GH_AW_SAFE_OUTPUTS_API_KEY
  553. export GH_AW_SAFE_OUTPUTS_TOOLS_PATH
  554. export GH_AW_SAFE_OUTPUTS_CONFIG_PATH
  555. export GH_AW_MCP_LOG_DIR
  556. bash "${RUNNER_TEMP}/gh-aw/actions/start_safe_outputs_server.sh"
  557. - name: Start MCP Gateway
  558. id: start-mcp-gateway
  559. env:
  560. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  561. GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-start.outputs.api_key }}
  562. GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-start.outputs.port }}
  563. GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  564. run: |
  565. set -eo pipefail
  566. mkdir -p /tmp/gh-aw/mcp-config
  567. # Export gateway environment variables for MCP config and gateway script
  568. export MCP_GATEWAY_PORT="80"
  569. export MCP_GATEWAY_DOMAIN="host.docker.internal"
  570. MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
  571. echo "::add-mask::${MCP_GATEWAY_API_KEY}"
  572. export MCP_GATEWAY_API_KEY
  573. export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads"
  574. mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}"
  575. export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288"
  576. export DEBUG="*"
  577. export GH_AW_ENGINE="codex"
  578. export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e 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_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 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 GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -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 ghcr.io/github/gh-aw-mcpg:v0.2.19'
  579. cat > /tmp/gh-aw/mcp-config/config.toml << GH_AW_MCP_CONFIG_d15f5801fc442b65_EOF
  580. [history]
  581. persistence = "none"
  582. [shell_environment_policy]
  583. inherit = "core"
  584. include_only = ["CODEX_API_KEY", "GH_AW_ASSETS_ALLOWED_EXTS", "GH_AW_ASSETS_BRANCH", "GH_AW_ASSETS_MAX_SIZE_KB", "GH_AW_SAFE_OUTPUTS", "GITHUB_PERSONAL_ACCESS_TOKEN", "GITHUB_REPOSITORY", "GITHUB_SERVER_URL", "HOME", "OPENAI_API_KEY", "PATH"]
  585. [mcp_servers.github]
  586. user_agent = "pr-review-intent"
  587. startup_timeout_sec = 120
  588. tool_timeout_sec = 60
  589. container = "ghcr.io/github/github-mcp-server:v0.32.0"
  590. env = { "GITHUB_HOST" = "$GITHUB_SERVER_URL", "GITHUB_PERSONAL_ACCESS_TOKEN" = "$GH_AW_GITHUB_TOKEN", "GITHUB_READ_ONLY" = "1", "GITHUB_TOOLSETS" = "context,repos,issues,pull_requests" }
  591. env_vars = ["GITHUB_HOST", "GITHUB_PERSONAL_ACCESS_TOKEN", "GITHUB_READ_ONLY", "GITHUB_TOOLSETS"]
  592. [mcp_servers.safeoutputs]
  593. type = "http"
  594. url = "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT"
  595. [mcp_servers.safeoutputs.headers]
  596. Authorization = "$GH_AW_SAFE_OUTPUTS_API_KEY"
  597. [mcp_servers.safeoutputs."guard-policies"]
  598. [mcp_servers.safeoutputs."guard-policies".write-sink]
  599. accept = ["*"]
  600. GH_AW_MCP_CONFIG_d15f5801fc442b65_EOF
  601. # Generate JSON config for MCP gateway
  602. cat << GH_AW_MCP_CONFIG_d15f5801fc442b65_EOF | bash "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh"
  603. {
  604. "mcpServers": {
  605. "github": {
  606. "container": "ghcr.io/github/github-mcp-server:v0.32.0",
  607. "env": {
  608. "GITHUB_HOST": "$GITHUB_SERVER_URL",
  609. "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_MCP_SERVER_TOKEN",
  610. "GITHUB_READ_ONLY": "1",
  611. "GITHUB_TOOLSETS": "context,repos,issues,pull_requests"
  612. },
  613. "guard-policies": {
  614. "allow-only": {
  615. "approval-labels": ${{ steps.parse-guard-vars.outputs.approval_labels }},
  616. "blocked-users": ${{ steps.parse-guard-vars.outputs.blocked_users }},
  617. "min-integrity": "none",
  618. "repos": "all",
  619. "trusted-users": ${{ steps.parse-guard-vars.outputs.trusted_users }}
  620. }
  621. }
  622. },
  623. "safeoutputs": {
  624. "type": "http",
  625. "url": "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT",
  626. "headers": {
  627. "Authorization": "$GH_AW_SAFE_OUTPUTS_API_KEY"
  628. },
  629. "guard-policies": {
  630. "write-sink": {
  631. "accept": [
  632. "*"
  633. ]
  634. }
  635. }
  636. }
  637. },
  638. "gateway": {
  639. "port": $MCP_GATEWAY_PORT,
  640. "domain": "${MCP_GATEWAY_DOMAIN}",
  641. "apiKey": "${MCP_GATEWAY_API_KEY}",
  642. "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}"
  643. }
  644. }
  645. GH_AW_MCP_CONFIG_d15f5801fc442b65_EOF
  646. - name: Download activation artifact
  647. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  648. with:
  649. name: activation
  650. path: /tmp/gh-aw
  651. - name: Clean git credentials
  652. continue-on-error: true
  653. run: bash "${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh"
  654. - name: Execute Codex CLI
  655. id: agentic_execution
  656. run: |
  657. set -o pipefail
  658. mkdir -p "$CODEX_HOME/logs" && touch /tmp/gh-aw/agent-step-summary.md
  659. (umask 177 && touch /tmp/gh-aw/agent-stdio.log)
  660. # shellcheck disable=SC1003
  661. sudo -E awf --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" --env-all --exclude-env CODEX_API_KEY --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --exclude-env OPENAI_API_KEY --allow-domains 172.30.0.1,ai-pixel.online,api-inference.modelscope.cn,api.commandcode.ai,api.deepseek.com,api.minimaxi.com,api.openai.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,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,open.bigmodel.cn,openai.com,opencode.ai,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,s.symcb.com,s.symcd.com,security.ubuntu.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.20 --skip-pull --enable-api-proxy --openai-api-target ai-pixel.online \
  662. -- /bin/bash -c 'export PATH="$(find /opt/hostedtoolcache -maxdepth 4 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && INSTRUCTION="$(cat /tmp/gh-aw/aw-prompts/prompt.txt)" && codex ${GH_AW_MODEL_AGENT_CODEX:+-c model="$GH_AW_MODEL_AGENT_CODEX" }exec -c web_search="disabled" -c fetch="disabled" --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check "$INSTRUCTION"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log
  663. env:
  664. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }}
  665. CODEX_HOME: /tmp/gh-aw/mcp-config
  666. GH_AW_MCP_CONFIG: /tmp/gh-aw/mcp-config/config.toml
  667. GH_AW_MODEL_AGENT_CODEX: gpt-5.4
  668. GH_AW_PHASE: agent
  669. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  670. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  671. GH_AW_VERSION: v0.68.3
  672. GITHUB_AW: true
  673. GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
  674. GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
  675. GIT_AUTHOR_NAME: github-actions[bot]
  676. GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
  677. GIT_COMMITTER_NAME: github-actions[bot]
  678. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  679. OPENAI_BASE_URL: https://ai-pixel.online
  680. RUST_LOG: trace,hyper_util=info,mio=info,reqwest=info,os_info=info,codex_otel=warn,codex_core=debug,ocodex_exec=debug
  681. - name: Configure Git credentials
  682. env:
  683. REPO_NAME: ${{ github.repository }}
  684. SERVER_URL: ${{ github.server_url }}
  685. GITHUB_TOKEN: ${{ github.token }}
  686. run: |
  687. git config --global user.email "github-actions[bot]@users.noreply.github.com"
  688. git config --global user.name "github-actions[bot]"
  689. git config --global am.keepcr true
  690. # Re-authenticate git with GitHub token
  691. SERVER_URL_STRIPPED="${SERVER_URL#https://}"
  692. git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
  693. echo "Git configured with standard GitHub Actions identity"
  694. - name: Stop MCP Gateway
  695. if: always()
  696. continue-on-error: true
  697. env:
  698. MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }}
  699. MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }}
  700. GATEWAY_PID: ${{ steps.start-mcp-gateway.outputs.gateway-pid }}
  701. run: |
  702. bash "${RUNNER_TEMP}/gh-aw/actions/stop_mcp_gateway.sh" "$GATEWAY_PID"
  703. - name: Redact secrets in logs
  704. if: always()
  705. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  706. with:
  707. script: |
  708. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  709. setupGlobals(core, github, context, exec, io, getOctokit);
  710. const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs');
  711. await main();
  712. env:
  713. 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'
  714. SECRET_CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  715. SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  716. SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  717. SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  718. SECRET_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  719. SECRET_PIXEL_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  720. - name: Append agent step summary
  721. if: always()
  722. run: bash "${RUNNER_TEMP}/gh-aw/actions/append_agent_step_summary.sh"
  723. - name: Copy Safe Outputs
  724. if: always()
  725. env:
  726. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  727. run: |
  728. mkdir -p /tmp/gh-aw
  729. cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true
  730. - name: Ingest agent output
  731. id: collect_output
  732. if: always()
  733. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  734. env:
  735. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  736. GH_AW_ALLOWED_DOMAINS: "172.30.0.1,ai-pixel.online,api-inference.modelscope.cn,api.commandcode.ai,api.deepseek.com,api.minimaxi.com,api.openai.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,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,open.bigmodel.cn,openai.com,opencode.ai,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,s.symcb.com,s.symcd.com,security.ubuntu.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com"
  737. GITHUB_SERVER_URL: ${{ github.server_url }}
  738. GITHUB_API_URL: ${{ github.api_url }}
  739. with:
  740. script: |
  741. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  742. setupGlobals(core, github, context, exec, io, getOctokit);
  743. const { main } = require('${{ runner.temp }}/gh-aw/actions/collect_ndjson_output.cjs');
  744. await main();
  745. - name: Parse agent logs for step summary
  746. if: always()
  747. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  748. env:
  749. GH_AW_AGENT_OUTPUT: /tmp/gh-aw/agent-stdio.log
  750. with:
  751. script: |
  752. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  753. setupGlobals(core, github, context, exec, io, getOctokit);
  754. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_codex_log.cjs');
  755. await main();
  756. - name: Parse MCP Gateway logs for step summary
  757. if: always()
  758. id: parse-mcp-gateway
  759. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  760. with:
  761. script: |
  762. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  763. setupGlobals(core, github, context, exec, io, getOctokit);
  764. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_mcp_gateway_log.cjs');
  765. await main();
  766. - name: Print firewall logs
  767. if: always()
  768. continue-on-error: true
  769. env:
  770. AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs
  771. run: |
  772. # Fix permissions on firewall logs so they can be uploaded as artifacts
  773. # AWF runs with sudo, creating files owned by root
  774. sudo chmod -R a+r /tmp/gh-aw/sandbox/firewall/logs 2>/dev/null || true
  775. # Only run awf logs summary if awf command exists (it may not be installed if workflow failed before install step)
  776. if command -v awf &> /dev/null; then
  777. awf logs summary | tee -a "$GITHUB_STEP_SUMMARY"
  778. else
  779. echo 'AWF binary not installed, skipping firewall log summary'
  780. fi
  781. - name: Parse token usage for step summary
  782. if: always()
  783. continue-on-error: true
  784. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  785. with:
  786. script: |
  787. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  788. setupGlobals(core, github, context, exec, io, getOctokit);
  789. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_token_usage.cjs');
  790. await main();
  791. - name: Write agent output placeholder if missing
  792. if: always()
  793. run: |
  794. if [ ! -f /tmp/gh-aw/agent_output.json ]; then
  795. echo '{"items":[]}' > /tmp/gh-aw/agent_output.json
  796. fi
  797. - name: Upload agent artifacts
  798. if: always()
  799. continue-on-error: true
  800. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  801. with:
  802. name: agent
  803. path: |
  804. /tmp/gh-aw/aw-prompts/prompt.txt
  805. /tmp/gh-aw/mcp-config/logs/
  806. /tmp/gh-aw/redacted-urls.log
  807. /tmp/gh-aw/mcp-logs/
  808. /tmp/gh-aw/proxy-logs/
  809. !/tmp/gh-aw/proxy-logs/proxy-tls/
  810. /tmp/gh-aw/agent_usage.json
  811. /tmp/gh-aw/agent-stdio.log
  812. /tmp/gh-aw/agent/
  813. /tmp/gh-aw/github_rate_limits.jsonl
  814. /tmp/gh-aw/safeoutputs.jsonl
  815. /tmp/gh-aw/agent_output.json
  816. /tmp/gh-aw/aw-*.patch
  817. /tmp/gh-aw/aw-*.bundle
  818. /tmp/gh-aw/sandbox/firewall/logs/
  819. /tmp/gh-aw/sandbox/firewall/audit/
  820. if-no-files-found: ignore
  821. conclusion:
  822. needs:
  823. - activation
  824. - agent
  825. - detection
  826. - safe_outputs
  827. if: >
  828. always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true' ||
  829. needs.activation.outputs.stale_lock_file_failed == 'true')
  830. runs-on: ubuntu-slim
  831. permissions:
  832. contents: read
  833. discussions: write
  834. issues: write
  835. pull-requests: write
  836. concurrency:
  837. group: "gh-aw-conclusion-pr-review-intent"
  838. cancel-in-progress: false
  839. outputs:
  840. incomplete_count: ${{ steps.report_incomplete.outputs.incomplete_count }}
  841. noop_message: ${{ steps.noop.outputs.noop_message }}
  842. tools_reported: ${{ steps.missing_tool.outputs.tools_reported }}
  843. total_count: ${{ steps.missing_tool.outputs.total_count }}
  844. steps:
  845. - name: Setup Scripts
  846. id: setup
  847. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  848. with:
  849. destination: ${{ runner.temp }}/gh-aw/actions
  850. job-name: ${{ github.job }}
  851. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  852. - name: Download agent output artifact
  853. id: download-agent-output
  854. continue-on-error: true
  855. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  856. with:
  857. name: agent
  858. path: /tmp/gh-aw/
  859. - name: Setup agent output environment variable
  860. id: setup-agent-output-env
  861. if: steps.download-agent-output.outcome == 'success'
  862. run: |
  863. mkdir -p /tmp/gh-aw/
  864. find "/tmp/gh-aw/" -type f -print
  865. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  866. - name: Process no-op messages
  867. id: noop
  868. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  869. env:
  870. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  871. GH_AW_NOOP_MAX: "1"
  872. GH_AW_WORKFLOW_NAME: "PR Review Intent"
  873. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  874. GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
  875. GH_AW_NOOP_REPORT_AS_ISSUE: "true"
  876. with:
  877. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  878. script: |
  879. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  880. setupGlobals(core, github, context, exec, io, getOctokit);
  881. const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_noop_message.cjs');
  882. await main();
  883. - name: Log detection run
  884. id: detection_runs
  885. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  886. env:
  887. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  888. GH_AW_WORKFLOW_NAME: "PR Review Intent"
  889. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  890. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  891. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  892. with:
  893. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  894. script: |
  895. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  896. setupGlobals(core, github, context, exec, io, getOctokit);
  897. const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_detection_runs.cjs');
  898. await main();
  899. - name: Record missing tool
  900. id: missing_tool
  901. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  902. env:
  903. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  904. GH_AW_MISSING_TOOL_CREATE_ISSUE: "true"
  905. GH_AW_WORKFLOW_NAME: "PR Review Intent"
  906. with:
  907. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  908. script: |
  909. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  910. setupGlobals(core, github, context, exec, io, getOctokit);
  911. const { main } = require('${{ runner.temp }}/gh-aw/actions/missing_tool.cjs');
  912. await main();
  913. - name: Record incomplete
  914. id: report_incomplete
  915. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  916. env:
  917. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  918. GH_AW_REPORT_INCOMPLETE_CREATE_ISSUE: "true"
  919. GH_AW_WORKFLOW_NAME: "PR Review Intent"
  920. with:
  921. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  922. script: |
  923. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  924. setupGlobals(core, github, context, exec, io, getOctokit);
  925. const { main } = require('${{ runner.temp }}/gh-aw/actions/report_incomplete_handler.cjs');
  926. await main();
  927. - name: Handle agent failure
  928. id: handle_agent_failure
  929. if: always()
  930. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  931. env:
  932. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  933. GH_AW_WORKFLOW_NAME: "PR Review Intent"
  934. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  935. GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
  936. GH_AW_WORKFLOW_ID: "pr-review-intent"
  937. GH_AW_ENGINE_ID: "codex"
  938. GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }}
  939. GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }}
  940. GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }}
  941. GH_AW_STALE_LOCK_FILE_FAILED: ${{ needs.activation.outputs.stale_lock_file_failed }}
  942. GH_AW_GROUP_REPORTS: "false"
  943. GH_AW_FAILURE_REPORT_AS_ISSUE: "true"
  944. GH_AW_TIMEOUT_MINUTES: "15"
  945. with:
  946. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  947. script: |
  948. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  949. setupGlobals(core, github, context, exec, io, getOctokit);
  950. const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_agent_failure.cjs');
  951. await main();
  952. detection:
  953. needs:
  954. - activation
  955. - agent
  956. if: >
  957. always() && needs.agent.result != 'skipped' && (needs.agent.outputs.output_types != '' || needs.agent.outputs.has_patch == 'true')
  958. runs-on: ubuntu-latest
  959. permissions:
  960. contents: read
  961. outputs:
  962. detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
  963. detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
  964. detection_success: ${{ steps.detection_conclusion.outputs.success }}
  965. steps:
  966. - name: Setup Scripts
  967. id: setup
  968. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  969. with:
  970. destination: ${{ runner.temp }}/gh-aw/actions
  971. job-name: ${{ github.job }}
  972. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  973. - name: Download agent output artifact
  974. id: download-agent-output
  975. continue-on-error: true
  976. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  977. with:
  978. name: agent
  979. path: /tmp/gh-aw/
  980. - name: Setup agent output environment variable
  981. id: setup-agent-output-env
  982. if: steps.download-agent-output.outcome == 'success'
  983. run: |
  984. mkdir -p /tmp/gh-aw/
  985. find "/tmp/gh-aw/" -type f -print
  986. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  987. - name: Checkout repository for patch context
  988. if: needs.agent.outputs.has_patch == 'true'
  989. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  990. with:
  991. persist-credentials: false
  992. # --- Threat Detection ---
  993. - name: Clean stale firewall files from agent artifact
  994. run: |
  995. rm -rf /tmp/gh-aw/sandbox/firewall/logs
  996. rm -rf /tmp/gh-aw/sandbox/firewall/audit
  997. - name: Download container images
  998. run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.20 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.20 ghcr.io/github/gh-aw-firewall/squid:0.25.20
  999. - name: Check if detection needed
  1000. id: detection_guard
  1001. if: always()
  1002. env:
  1003. OUTPUT_TYPES: ${{ needs.agent.outputs.output_types }}
  1004. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1005. run: |
  1006. if [[ -n "$OUTPUT_TYPES" || "$HAS_PATCH" == "true" ]]; then
  1007. echo "run_detection=true" >> "$GITHUB_OUTPUT"
  1008. echo "Detection will run: output_types=$OUTPUT_TYPES, has_patch=$HAS_PATCH"
  1009. else
  1010. echo "run_detection=false" >> "$GITHUB_OUTPUT"
  1011. echo "Detection skipped: no agent outputs or patches to analyze"
  1012. fi
  1013. - name: Clear MCP configuration for detection
  1014. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1015. run: |
  1016. rm -f /tmp/gh-aw/mcp-config/mcp-servers.json
  1017. rm -f /home/runner/.copilot/mcp-config.json
  1018. rm -f "$GITHUB_WORKSPACE/.gemini/settings.json"
  1019. - name: Prepare threat detection files
  1020. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1021. run: |
  1022. mkdir -p /tmp/gh-aw/threat-detection/aw-prompts
  1023. cp /tmp/gh-aw/aw-prompts/prompt.txt /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt 2>/dev/null || true
  1024. cp /tmp/gh-aw/agent_output.json /tmp/gh-aw/threat-detection/agent_output.json 2>/dev/null || true
  1025. for f in /tmp/gh-aw/aw-*.patch; do
  1026. [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true
  1027. done
  1028. for f in /tmp/gh-aw/aw-*.bundle; do
  1029. [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true
  1030. done
  1031. echo "Prepared threat detection files:"
  1032. ls -la /tmp/gh-aw/threat-detection/ 2>/dev/null || true
  1033. - name: Setup threat detection
  1034. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1035. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  1036. env:
  1037. WORKFLOW_NAME: "PR Review Intent"
  1038. WORKFLOW_DESCRIPTION: "自动审计 Pull Request 的代码意图、隐含约束、实现对齐情况与发布风险"
  1039. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1040. with:
  1041. script: |
  1042. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1043. setupGlobals(core, github, context, exec, io, getOctokit);
  1044. const { main } = require('${{ runner.temp }}/gh-aw/actions/setup_threat_detection.cjs');
  1045. await main();
  1046. - name: Ensure threat-detection directory and log
  1047. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1048. run: |
  1049. mkdir -p /tmp/gh-aw/threat-detection
  1050. touch /tmp/gh-aw/threat-detection/detection.log
  1051. - name: Setup Node.js
  1052. uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
  1053. with:
  1054. node-version: '24'
  1055. package-manager-cache: false
  1056. - name: Install Codex CLI
  1057. run: npm install --ignore-scripts -g @openai/codex@0.118.0
  1058. - name: Install AWF binary
  1059. run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.20
  1060. - name: Execute Codex CLI
  1061. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1062. id: detection_agentic_execution
  1063. run: |
  1064. set -o pipefail
  1065. mkdir -p "$CODEX_HOME/logs" && touch /tmp/gh-aw/agent-step-summary.md
  1066. (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
  1067. # shellcheck disable=SC1003
  1068. sudo -E awf --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" --env-all --exclude-env CODEX_API_KEY --exclude-env OPENAI_API_KEY --allow-domains 172.30.0.1,api.openai.com,host.docker.internal,openai.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --image-tag 0.25.20 --skip-pull --enable-api-proxy --openai-api-target ai-pixel.online \
  1069. -- /bin/bash -c 'export PATH="$(find /opt/hostedtoolcache -maxdepth 4 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && INSTRUCTION="$(cat /tmp/gh-aw/aw-prompts/prompt.txt)" && codex ${GH_AW_MODEL_DETECTION_CODEX:+-c model="$GH_AW_MODEL_DETECTION_CODEX" }exec -c web_search="disabled" -c fetch="disabled" --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check "$INSTRUCTION"' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log
  1070. env:
  1071. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }}
  1072. CODEX_HOME: /tmp/gh-aw/mcp-config
  1073. GH_AW_MCP_CONFIG: /tmp/gh-aw/mcp-config/config.toml
  1074. GH_AW_MODEL_DETECTION_CODEX: gpt-5.4
  1075. GH_AW_PHASE: detection
  1076. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  1077. GH_AW_VERSION: v0.68.3
  1078. GITHUB_AW: true
  1079. GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
  1080. GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
  1081. GIT_AUTHOR_NAME: github-actions[bot]
  1082. GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
  1083. GIT_COMMITTER_NAME: github-actions[bot]
  1084. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1085. OPENAI_BASE_URL: https://ai-pixel.online
  1086. RUST_LOG: trace,hyper_util=info,mio=info,reqwest=info,os_info=info,codex_otel=warn,codex_core=debug,ocodex_exec=debug
  1087. - name: Upload threat detection log
  1088. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1089. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1090. with:
  1091. name: detection
  1092. path: /tmp/gh-aw/threat-detection/detection.log
  1093. if-no-files-found: ignore
  1094. - name: Parse and conclude threat detection
  1095. id: detection_conclusion
  1096. if: always()
  1097. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  1098. env:
  1099. RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
  1100. GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
  1101. with:
  1102. script: |
  1103. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1104. setupGlobals(core, github, context, exec, io, getOctokit);
  1105. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_threat_detection_results.cjs');
  1106. await main();
  1107. safe_outputs:
  1108. needs:
  1109. - activation
  1110. - agent
  1111. - detection
  1112. if: (!cancelled()) && needs.agent.result != 'skipped' && needs.detection.result == 'success'
  1113. runs-on: ubuntu-slim
  1114. permissions:
  1115. contents: read
  1116. discussions: write
  1117. issues: write
  1118. pull-requests: write
  1119. timeout-minutes: 15
  1120. env:
  1121. GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/pr-review-intent"
  1122. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  1123. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  1124. GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens }}
  1125. GH_AW_ENGINE_ID: "codex"
  1126. GH_AW_ENGINE_MODEL: "gpt-5.4"
  1127. GH_AW_WORKFLOW_ID: "pr-review-intent"
  1128. GH_AW_WORKFLOW_NAME: "PR Review Intent"
  1129. outputs:
  1130. code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }}
  1131. code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }}
  1132. comment_id: ${{ steps.process_safe_outputs.outputs.comment_id }}
  1133. comment_url: ${{ steps.process_safe_outputs.outputs.comment_url }}
  1134. create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }}
  1135. create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }}
  1136. process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }}
  1137. process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }}
  1138. steps:
  1139. - name: Setup Scripts
  1140. id: setup
  1141. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  1142. with:
  1143. destination: ${{ runner.temp }}/gh-aw/actions
  1144. job-name: ${{ github.job }}
  1145. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1146. - name: Download agent output artifact
  1147. id: download-agent-output
  1148. continue-on-error: true
  1149. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1150. with:
  1151. name: agent
  1152. path: /tmp/gh-aw/
  1153. - name: Setup agent output environment variable
  1154. id: setup-agent-output-env
  1155. if: steps.download-agent-output.outcome == 'success'
  1156. run: |
  1157. mkdir -p /tmp/gh-aw/
  1158. find "/tmp/gh-aw/" -type f -print
  1159. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1160. - name: Configure GH_HOST for enterprise compatibility
  1161. id: ghes-host-config
  1162. shell: bash
  1163. run: |
  1164. # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct
  1165. # GitHub instance (GHES/GHEC). On github.com this is a harmless no-op.
  1166. GH_HOST="${GITHUB_SERVER_URL#https://}"
  1167. GH_HOST="${GH_HOST#http://}"
  1168. echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV"
  1169. - name: Process Safe Outputs
  1170. id: process_safe_outputs
  1171. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  1172. env:
  1173. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1174. GH_AW_ALLOWED_DOMAINS: "172.30.0.1,ai-pixel.online,api-inference.modelscope.cn,api.commandcode.ai,api.deepseek.com,api.minimaxi.com,api.openai.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,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,open.bigmodel.cn,openai.com,opencode.ai,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,s.symcb.com,s.symcd.com,security.ubuntu.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com"
  1175. GITHUB_SERVER_URL: ${{ github.server_url }}
  1176. GITHUB_API_URL: ${{ github.api_url }}
  1177. GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":1,\"target\":\"triggering\"},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"true\"},\"report_incomplete\":{}}"
  1178. with:
  1179. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1180. script: |
  1181. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1182. setupGlobals(core, github, context, exec, io, getOctokit);
  1183. const { main } = require('${{ runner.temp }}/gh-aw/actions/safe_output_handler_manager.cjs');
  1184. await main();
  1185. - name: Upload Safe Outputs Items
  1186. if: always()
  1187. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1188. with:
  1189. name: safe-outputs-items
  1190. path: |
  1191. /tmp/gh-aw/safe-output-items.jsonl
  1192. /tmp/gh-aw/temporary-id-map.json
  1193. if-no-files-found: ignore