pr-review-intent.lock.yml 67 KB

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