weekly-report.lock.yml 87 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512
  1. # gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"d5e049f0e9059d227cd2cd109564c000330332ca3e8d1748db87432bfd43451c","body_hash":"6b24abcba9aa7cf0b67ca6c52242a557782e72c315cb9e935e00e501f40f1e84","compiler_version":"v0.77.5","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":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"3ea13c02d765410340d533515cb31a7eef2baaf0","version":"v0.77.5"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.58"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.58"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.22"},{"image":"ghcr.io/github/github-mcp-server:v1.1.0"},{"image":"node:lts-alpine","digest":"sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14","pinned_image":"node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14"}]}
  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.77.5). 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. # 每周自动生成仓库活动报告,包括 PR/Issue 列表、Changelog、贡献者统计等
  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@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  44. # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
  45. # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  46. # - github/gh-aw-actions/setup@3ea13c02d765410340d533515cb31a7eef2baaf0 # v0.77.5
  47. #
  48. # Container images used:
  49. # - ghcr.io/github/gh-aw-firewall/agent:0.25.58
  50. # - ghcr.io/github/gh-aw-firewall/api-proxy:0.25.58
  51. # - ghcr.io/github/gh-aw-firewall/squid:0.25.58
  52. # - ghcr.io/github/gh-aw-mcpg:v0.3.22
  53. # - ghcr.io/github/github-mcp-server:v1.1.0
  54. # - node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14
  55. name: "Weekly Report"
  56. on:
  57. schedule:
  58. - cron: "0 17 * * 4"
  59. workflow_dispatch:
  60. inputs:
  61. aw_context:
  62. default: ""
  63. description: "Agent caller context (used internally by Agentic Workflows)."
  64. required: false
  65. type: string
  66. permissions: {}
  67. concurrency:
  68. group: "gh-aw-${{ github.workflow }}"
  69. run-name: "Weekly Report"
  70. jobs:
  71. activation:
  72. runs-on: ubuntu-slim
  73. permissions:
  74. actions: read
  75. contents: read
  76. outputs:
  77. comment_id: ""
  78. comment_repo: ""
  79. engine_id: ${{ steps.generate_aw_info.outputs.engine_id }}
  80. lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }}
  81. model: ${{ steps.generate_aw_info.outputs.model }}
  82. secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }}
  83. setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }}
  84. setup-span-id: ${{ steps.setup.outputs.span-id }}
  85. setup-trace-id: ${{ steps.setup.outputs.trace-id }}
  86. stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }}
  87. steps:
  88. - name: Setup Scripts
  89. id: setup
  90. uses: github/gh-aw-actions/setup@3ea13c02d765410340d533515cb31a7eef2baaf0 # v0.77.5
  91. with:
  92. destination: ${{ runner.temp }}/gh-aw/actions
  93. job-name: ${{ github.job }}
  94. env:
  95. GH_AW_SETUP_WORKFLOW_NAME: "Weekly Report"
  96. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/weekly-report.lock.yml@${{ github.ref }}
  97. GH_AW_INFO_VERSION: "0.135.0"
  98. GH_AW_INFO_AWF_VERSION: "v0.25.58"
  99. GH_AW_INFO_ENGINE_ID: "codex"
  100. - name: Generate agentic run info
  101. id: generate_aw_info
  102. env:
  103. GH_AW_INFO_ENGINE_ID: "codex"
  104. GH_AW_INFO_ENGINE_NAME: "Codex"
  105. GH_AW_INFO_MODEL: "gpt-5.4"
  106. GH_AW_INFO_VERSION: "0.135.0"
  107. GH_AW_INFO_AGENT_VERSION: "0.135.0"
  108. GH_AW_INFO_CLI_VERSION: "v0.77.5"
  109. GH_AW_INFO_WORKFLOW_NAME: "Weekly Report"
  110. GH_AW_INFO_EXPERIMENTAL: "false"
  111. GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true"
  112. GH_AW_INFO_STAGED: "false"
  113. 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"]'
  114. GH_AW_INFO_FIREWALL_ENABLED: "true"
  115. GH_AW_INFO_AWF_VERSION: "v0.25.58"
  116. GH_AW_INFO_AWMG_VERSION: ""
  117. GH_AW_INFO_FIREWALL_TYPE: "squid"
  118. GH_AW_COMPILED_STRICT: "true"
  119. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  120. with:
  121. script: |
  122. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  123. setupGlobals(core, github, context, exec, io, getOctokit);
  124. const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_aw_info.cjs');
  125. await main(core, context);
  126. - name: Validate CODEX_API_KEY or OPENAI_API_KEY secret
  127. id: validate-secret
  128. 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
  129. env:
  130. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  131. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  132. - name: Checkout .github and .agents folders
  133. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  134. with:
  135. persist-credentials: false
  136. sparse-checkout: |
  137. .github
  138. .agents
  139. .antigravity
  140. .claude
  141. .codex
  142. .crush
  143. .gemini
  144. .opencode
  145. .pi
  146. sparse-checkout-cone-mode: true
  147. fetch-depth: 1
  148. - name: Save agent config folders for base branch restoration
  149. env:
  150. GH_AW_AGENT_FOLDERS: ".agents .antigravity .claude .codex .crush .gemini .github .opencode .pi"
  151. GH_AW_AGENT_FILES: ".crush.json AGENTS.md ANTIGRAVITY.md CLAUDE.md GEMINI.md PI.md opencode.jsonc"
  152. # poutine:ignore untrusted_checkout_exec
  153. run: bash "${RUNNER_TEMP}/gh-aw/actions/save_base_github_folders.sh"
  154. - name: Check workflow lock file
  155. id: check-lock-file
  156. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  157. env:
  158. GH_AW_WORKFLOW_FILE: "weekly-report.lock.yml"
  159. GH_AW_CONTEXT_WORKFLOW_REF: "${{ github.workflow_ref }}"
  160. with:
  161. script: |
  162. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  163. setupGlobals(core, github, context, exec, io, getOctokit);
  164. const { main } = require('${{ runner.temp }}/gh-aw/actions/check_workflow_timestamp_api.cjs');
  165. await main();
  166. - name: Check compile-agentic version
  167. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  168. env:
  169. GH_AW_COMPILED_VERSION: "v0.77.5"
  170. with:
  171. script: |
  172. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  173. setupGlobals(core, github, context, exec, io, getOctokit);
  174. const { main } = require('${{ runner.temp }}/gh-aw/actions/check_version_updates.cjs');
  175. await main();
  176. - name: Create prompt with built-in context
  177. env:
  178. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  179. GH_AW_SAFE_OUTPUTS: ${{ runner.temp }}/gh-aw/safeoutputs/outputs.jsonl
  180. GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  181. GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  182. GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  183. GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }}
  184. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  185. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  186. GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
  187. GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
  188. # poutine:ignore untrusted_checkout_exec
  189. run: |
  190. bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh"
  191. {
  192. cat << 'GH_AW_PROMPT_abb639e11ed360dd_EOF'
  193. <system>
  194. GH_AW_PROMPT_abb639e11ed360dd_EOF
  195. cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md"
  196. cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md"
  197. cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md"
  198. cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md"
  199. cat << 'GH_AW_PROMPT_abb639e11ed360dd_EOF'
  200. <safe-output-tools>
  201. Tools: create_issue, missing_tool, missing_data, noop
  202. </safe-output-tools>
  203. GH_AW_PROMPT_abb639e11ed360dd_EOF
  204. cat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md"
  205. cat << 'GH_AW_PROMPT_abb639e11ed360dd_EOF'
  206. <github-context>
  207. The following GitHub context information is available for this workflow:
  208. {{#if github.actor}}
  209. - **actor**: __GH_AW_GITHUB_ACTOR__
  210. {{/if}}
  211. {{#if github.repository}}
  212. - **repository**: __GH_AW_GITHUB_REPOSITORY__
  213. {{/if}}
  214. {{#if github.workspace}}
  215. - **workspace**: __GH_AW_GITHUB_WORKSPACE__
  216. {{/if}}
  217. {{#if github.event.issue.number || (github.aw.context.item_type == 'issue' && github.aw.context.item_number)}}
  218. - **issue-number**: #__GH_AW_EXPR_802A9F6A__
  219. {{/if}}
  220. {{#if github.event.discussion.number || (github.aw.context.item_type == 'discussion' && github.aw.context.item_number)}}
  221. - **discussion-number**: #__GH_AW_EXPR_1A3A194A__
  222. {{/if}}
  223. {{#if github.event.pull_request.number || (github.aw.context.item_type == 'pull_request' && github.aw.context.item_number)}}
  224. - **pull-request-number**: #__GH_AW_EXPR_463A214A__
  225. {{/if}}
  226. {{#if github.event.comment.id || github.aw.context.comment_id}}
  227. - **comment-id**: __GH_AW_EXPR_FF1D34CE__
  228. {{/if}}
  229. {{#if github.run_id}}
  230. - **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__
  231. {{/if}}
  232. </github-context>
  233. GH_AW_PROMPT_abb639e11ed360dd_EOF
  234. cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md"
  235. cat << 'GH_AW_PROMPT_abb639e11ed360dd_EOF'
  236. </system>
  237. {{#runtime-import .github/workflows/shared/engine.md}}
  238. {{#runtime-import .github/workflows/shared/network.md}}
  239. {{#runtime-import .github/workflows/weekly-report.md}}
  240. GH_AW_PROMPT_abb639e11ed360dd_EOF
  241. } > "$GH_AW_PROMPT"
  242. - name: Interpolate variables and render templates
  243. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  244. env:
  245. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  246. GH_AW_ENGINE_ID: "codex"
  247. with:
  248. script: |
  249. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  250. setupGlobals(core, github, context, exec, io, getOctokit);
  251. const { main } = require('${{ runner.temp }}/gh-aw/actions/interpolate_prompt.cjs');
  252. await main();
  253. - name: Substitute placeholders
  254. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  255. env:
  256. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  257. GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  258. GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  259. GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }}
  260. GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }}
  261. GH_AW_GITHUB_ACTOR: ${{ github.actor }}
  262. GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
  263. GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
  264. GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
  265. GH_AW_MCP_CLI_SERVERS_LIST: '- `safeoutputs` — run `safeoutputs --help` to see available tools'
  266. with:
  267. script: |
  268. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  269. setupGlobals(core, github, context, exec, io, getOctokit);
  270. const substitutePlaceholders = require('${{ runner.temp }}/gh-aw/actions/substitute_placeholders.cjs');
  271. // Call the substitution function
  272. return await substitutePlaceholders({
  273. file: process.env.GH_AW_PROMPT,
  274. substitutions: {
  275. GH_AW_EXPR_1A3A194A: process.env.GH_AW_EXPR_1A3A194A,
  276. GH_AW_EXPR_463A214A: process.env.GH_AW_EXPR_463A214A,
  277. GH_AW_EXPR_802A9F6A: process.env.GH_AW_EXPR_802A9F6A,
  278. GH_AW_EXPR_FF1D34CE: process.env.GH_AW_EXPR_FF1D34CE,
  279. GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR,
  280. GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY,
  281. GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID,
  282. GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE,
  283. GH_AW_MCP_CLI_SERVERS_LIST: process.env.GH_AW_MCP_CLI_SERVERS_LIST
  284. }
  285. });
  286. - name: Validate prompt placeholders
  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/validate_prompt_placeholders.sh"
  291. - name: Print prompt
  292. env:
  293. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  294. # poutine:ignore untrusted_checkout_exec
  295. run: bash "${RUNNER_TEMP}/gh-aw/actions/print_prompt_summary.sh"
  296. - name: Upload activation artifact
  297. if: success()
  298. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  299. with:
  300. name: activation
  301. include-hidden-files: true
  302. path: |
  303. /tmp/gh-aw/aw_info.json
  304. /tmp/gh-aw/model_multipliers.json
  305. /tmp/gh-aw/aw-prompts/prompt.txt
  306. /tmp/gh-aw/aw-prompts/prompt-template.txt
  307. /tmp/gh-aw/aw-prompts/prompt-import-tree.json
  308. /tmp/gh-aw/github_rate_limits.jsonl
  309. /tmp/gh-aw/base
  310. /tmp/gh-aw/.codex/agents
  311. /tmp/gh-aw/.codex/skills
  312. if-no-files-found: ignore
  313. retention-days: 1
  314. agent:
  315. needs: activation
  316. runs-on: ubuntu-latest
  317. permissions:
  318. contents: read
  319. discussions: read
  320. issues: read
  321. pull-requests: read
  322. concurrency:
  323. group: "gh-aw-codex-${{ github.workflow }}"
  324. queue: max
  325. env:
  326. DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
  327. GH_AW_ASSETS_ALLOWED_EXTS: ""
  328. GH_AW_ASSETS_BRANCH: ""
  329. GH_AW_ASSETS_MAX_SIZE_KB: 0
  330. GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs
  331. GH_AW_WORKFLOW_ID_SANITIZED: weeklyreport
  332. outputs:
  333. checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }}
  334. effective_tokens: ${{ steps.parse-mcp-gateway.outputs.effective_tokens }}
  335. effective_tokens_rate_limit_error: ${{ steps.parse-mcp-gateway.outputs.effective_tokens_rate_limit_error || 'false' }}
  336. has_patch: ${{ steps.collect_output.outputs.has_patch }}
  337. model: ${{ needs.activation.outputs.model }}
  338. output: ${{ steps.collect_output.outputs.output }}
  339. output_types: ${{ steps.collect_output.outputs.output_types }}
  340. setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }}
  341. setup-span-id: ${{ steps.setup.outputs.span-id }}
  342. setup-trace-id: ${{ steps.setup.outputs.trace-id }}
  343. steps:
  344. - name: Setup Scripts
  345. id: setup
  346. uses: github/gh-aw-actions/setup@3ea13c02d765410340d533515cb31a7eef2baaf0 # v0.77.5
  347. with:
  348. destination: ${{ runner.temp }}/gh-aw/actions
  349. job-name: ${{ github.job }}
  350. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  351. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  352. env:
  353. GH_AW_SETUP_WORKFLOW_NAME: "Weekly Report"
  354. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/weekly-report.lock.yml@${{ github.ref }}
  355. GH_AW_INFO_VERSION: "0.135.0"
  356. GH_AW_INFO_AWF_VERSION: "v0.25.58"
  357. GH_AW_INFO_ENGINE_ID: "codex"
  358. - name: Set runtime paths
  359. id: set-runtime-paths
  360. run: |
  361. {
  362. echo "GH_AW_SAFE_OUTPUTS=${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl"
  363. echo "GH_AW_SAFE_OUTPUTS_CONFIG_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/config.json"
  364. echo "GH_AW_SAFE_OUTPUTS_TOOLS_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/tools.json"
  365. } >> "$GITHUB_OUTPUT"
  366. - name: Checkout repository
  367. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  368. with:
  369. persist-credentials: false
  370. - name: Create gh-aw temp directory
  371. run: bash "${RUNNER_TEMP}/gh-aw/actions/create_gh_aw_tmp_dir.sh"
  372. - name: Configure gh CLI for GitHub Enterprise
  373. run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_gh_for_ghe.sh"
  374. env:
  375. GH_TOKEN: ${{ github.token }}
  376. - name: Configure Git credentials
  377. env:
  378. REPO_NAME: ${{ github.repository }}
  379. SERVER_URL: ${{ github.server_url }}
  380. GITHUB_TOKEN: ${{ github.token }}
  381. run: |
  382. git config --global user.email "github-actions[bot]@users.noreply.github.com"
  383. git config --global user.name "github-actions[bot]"
  384. git config --global am.keepcr true
  385. # Re-authenticate git with GitHub token
  386. SERVER_URL_STRIPPED="${SERVER_URL#https://}"
  387. git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
  388. echo "Git configured with standard GitHub Actions identity"
  389. - name: Checkout PR branch
  390. id: checkout-pr
  391. if: |
  392. github.event.pull_request || github.event.issue.pull_request
  393. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  394. env:
  395. GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  396. with:
  397. github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  398. script: |
  399. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  400. setupGlobals(core, github, context, exec, io, getOctokit);
  401. const { main } = require('${{ runner.temp }}/gh-aw/actions/checkout_pr_branch.cjs');
  402. await main();
  403. - name: Setup Node.js
  404. uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
  405. with:
  406. node-version: '24'
  407. package-manager-cache: false
  408. - name: Install Codex CLI
  409. run: npm install --ignore-scripts -g @openai/codex@0.135.0
  410. - name: Install AWF binary
  411. run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.58
  412. - name: Parse integrity filter lists
  413. id: parse-guard-vars
  414. env:
  415. GH_AW_BLOCKED_USERS_VAR: ${{ vars.GH_AW_GITHUB_BLOCKED_USERS || '' }}
  416. GH_AW_TRUSTED_USERS_VAR: ${{ vars.GH_AW_GITHUB_TRUSTED_USERS || '' }}
  417. GH_AW_APPROVAL_LABELS_VAR: ${{ vars.GH_AW_GITHUB_APPROVAL_LABELS || '' }}
  418. run: bash "${RUNNER_TEMP}/gh-aw/actions/parse_guard_list.sh"
  419. - name: Download activation artifact
  420. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  421. with:
  422. name: activation
  423. path: /tmp/gh-aw
  424. - name: Restore agent config folders from base branch
  425. if: steps.checkout-pr.outcome == 'success'
  426. env:
  427. GH_AW_AGENT_FOLDERS: ".agents .antigravity .claude .codex .crush .gemini .github .opencode .pi"
  428. GH_AW_AGENT_FILES: ".crush.json AGENTS.md ANTIGRAVITY.md CLAUDE.md GEMINI.md PI.md opencode.jsonc"
  429. run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_base_github_folders.sh"
  430. - name: Restore inline sub-agents from activation artifact
  431. env:
  432. GH_AW_SUB_AGENT_DIR: ".codex/agents"
  433. GH_AW_SUB_AGENT_EXT: ".md"
  434. run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_sub_agents.sh"
  435. - name: Restore inline skills from activation artifact
  436. env:
  437. GH_AW_SKILL_DIR: ".codex/skills"
  438. run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_skills.sh"
  439. - name: Download container images
  440. run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.58 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.58 ghcr.io/github/gh-aw-firewall/squid:0.25.58 ghcr.io/github/gh-aw-mcpg:v0.3.22 ghcr.io/github/github-mcp-server:v1.1.0 node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14
  441. - name: Generate Safe Outputs Config
  442. run: |
  443. mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs"
  444. mkdir -p /tmp/gh-aw/safeoutputs
  445. mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs
  446. cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_f707cd406f1f2c29_EOF'
  447. {"create_issue":{"close_older_issues":true,"expires":720,"labels":["weekly-report","report"],"max":1,"title_prefix":"Weekly Report: "},"create_report_incomplete_issue":{},"max_bot_mentions":1,"mentions":{"enabled":false},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}}
  448. GH_AW_SAFE_OUTPUTS_CONFIG_f707cd406f1f2c29_EOF
  449. - name: Generate Safe Outputs Tools
  450. env:
  451. GH_AW_TOOLS_META_JSON: |
  452. {
  453. "description_suffixes": {
  454. "create_issue": " CONSTRAINTS: Maximum 1 issue(s) can be created. Title will be prefixed with \"Weekly Report: \". Labels [\"weekly-report\" \"report\"] will be automatically added."
  455. },
  456. "repo_params": {},
  457. "dynamic_tools": []
  458. }
  459. GH_AW_VALIDATION_JSON: |
  460. {
  461. "create_issue": {
  462. "defaultMax": 1,
  463. "fields": {
  464. "body": {
  465. "required": true,
  466. "type": "string",
  467. "sanitize": true,
  468. "maxLength": 65000
  469. },
  470. "fields": {
  471. "type": "array"
  472. },
  473. "labels": {
  474. "type": "array",
  475. "itemType": "string",
  476. "itemSanitize": true,
  477. "itemMaxLength": 128
  478. },
  479. "parent": {
  480. "issueOrPRNumber": true
  481. },
  482. "repo": {
  483. "type": "string",
  484. "maxLength": 256
  485. },
  486. "temporary_id": {
  487. "type": "string"
  488. },
  489. "title": {
  490. "required": true,
  491. "type": "string",
  492. "sanitize": true,
  493. "maxLength": 128
  494. }
  495. }
  496. },
  497. "missing_data": {
  498. "defaultMax": 20,
  499. "fields": {
  500. "alternatives": {
  501. "type": "string",
  502. "sanitize": true,
  503. "maxLength": 256
  504. },
  505. "context": {
  506. "type": "string",
  507. "sanitize": true,
  508. "maxLength": 256
  509. },
  510. "data_type": {
  511. "type": "string",
  512. "sanitize": true,
  513. "maxLength": 128
  514. },
  515. "reason": {
  516. "type": "string",
  517. "sanitize": true,
  518. "maxLength": 256
  519. }
  520. }
  521. },
  522. "missing_tool": {
  523. "defaultMax": 20,
  524. "fields": {
  525. "alternatives": {
  526. "type": "string",
  527. "sanitize": true,
  528. "maxLength": 512
  529. },
  530. "reason": {
  531. "required": true,
  532. "type": "string",
  533. "sanitize": true,
  534. "maxLength": 256
  535. },
  536. "tool": {
  537. "type": "string",
  538. "sanitize": true,
  539. "maxLength": 128
  540. }
  541. }
  542. },
  543. "noop": {
  544. "defaultMax": 1,
  545. "fields": {
  546. "message": {
  547. "required": true,
  548. "type": "string",
  549. "sanitize": true,
  550. "maxLength": 65000
  551. }
  552. }
  553. },
  554. "report_incomplete": {
  555. "defaultMax": 5,
  556. "fields": {
  557. "details": {
  558. "type": "string",
  559. "sanitize": true,
  560. "maxLength": 65000
  561. },
  562. "reason": {
  563. "required": true,
  564. "type": "string",
  565. "sanitize": true,
  566. "maxLength": 1024
  567. }
  568. }
  569. }
  570. }
  571. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  572. with:
  573. script: |
  574. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  575. setupGlobals(core, github, context, exec, io, getOctokit);
  576. const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_safe_outputs_tools.cjs');
  577. await main();
  578. - name: Generate Safe Outputs MCP Server Config
  579. id: safe-outputs-config
  580. run: |
  581. # Generate a secure random API key (360 bits of entropy, 40+ chars)
  582. # Mask immediately to prevent timing vulnerabilities
  583. API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
  584. echo "::add-mask::${API_KEY}"
  585. PORT=3001
  586. # Set outputs for next steps
  587. {
  588. echo "safe_outputs_api_key=${API_KEY}"
  589. echo "safe_outputs_port=${PORT}"
  590. } >> "$GITHUB_OUTPUT"
  591. echo "Safe Outputs MCP server will run on port ${PORT}"
  592. - name: Start Safe Outputs MCP HTTP Server
  593. id: safe-outputs-start
  594. env:
  595. DEBUG: '*'
  596. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  597. GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-config.outputs.safe_outputs_port }}
  598. GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-config.outputs.safe_outputs_api_key }}
  599. GH_AW_SAFE_OUTPUTS_TOOLS_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/tools.json
  600. GH_AW_SAFE_OUTPUTS_CONFIG_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/config.json
  601. GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs
  602. run: |
  603. # Environment variables are set above to prevent template injection
  604. export DEBUG
  605. export GH_AW_SAFE_OUTPUTS
  606. export GH_AW_SAFE_OUTPUTS_PORT
  607. export GH_AW_SAFE_OUTPUTS_API_KEY
  608. export GH_AW_SAFE_OUTPUTS_TOOLS_PATH
  609. export GH_AW_SAFE_OUTPUTS_CONFIG_PATH
  610. export GH_AW_MCP_LOG_DIR
  611. bash "${RUNNER_TEMP}/gh-aw/actions/start_safe_outputs_server.sh"
  612. - name: Start MCP Gateway
  613. id: start-mcp-gateway
  614. env:
  615. CODEX_HOME: /tmp/gh-aw/mcp-config
  616. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  617. GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-start.outputs.api_key }}
  618. GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-start.outputs.port }}
  619. GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  620. run: |
  621. set -eo pipefail
  622. mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config"
  623. # Export gateway environment variables for MCP config and gateway script
  624. export MCP_GATEWAY_PORT="8080"
  625. export MCP_GATEWAY_DOMAIN="host.docker.internal"
  626. export MCP_GATEWAY_HOST_DOMAIN="localhost"
  627. MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
  628. echo "::add-mask::${MCP_GATEWAY_API_KEY}"
  629. export MCP_GATEWAY_API_KEY
  630. export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads"
  631. mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}"
  632. export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288"
  633. export DEBUG="*"
  634. export GH_AW_ENGINE="codex"
  635. MCP_GATEWAY_UID=$(id -u 2>/dev/null || echo '0')
  636. MCP_GATEWAY_GID=$(id -g 2>/dev/null || echo '0')
  637. case "${DOCKER_HOST:-}" in
  638. unix://* ) DOCKER_SOCK_PATH="${DOCKER_HOST#unix://}" ;;
  639. /* ) DOCKER_SOCK_PATH="$DOCKER_HOST" ;;
  640. * ) DOCKER_SOCK_PATH=/var/run/docker.sock ;;
  641. esac
  642. DOCKER_SOCK_GID=$(stat -c '%g' "$DOCKER_SOCK_PATH" 2>/dev/null || echo '0')
  643. export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host --add-host host.docker.internal:127.0.0.1 --user '"${MCP_GATEWAY_UID}"':'"${MCP_GATEWAY_GID}"' --group-add '"${DOCKER_SOCK_GID}"' -v '"${DOCKER_SOCK_PATH}"':/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DOCKER_HOST=unix:///var/run/docker.sock -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_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 -e CODEX_HOME -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.3.22'
  644. cat > "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" << GH_AW_MCP_CONFIG_0ea6235960c71f1a_EOF
  645. [history]
  646. persistence = "none"
  647. [shell_environment_policy]
  648. inherit = "core"
  649. 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$"]
  650. [mcp_servers.github]
  651. user_agent = "weekly-report"
  652. startup_timeout_sec = 120
  653. tool_timeout_sec = 60
  654. container = "ghcr.io/github/github-mcp-server:v1.1.0"
  655. 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" }
  656. env_vars = ["GITHUB_HOST", "GITHUB_PERSONAL_ACCESS_TOKEN", "GITHUB_READ_ONLY", "GITHUB_TOOLSETS"]
  657. [mcp_servers.safeoutputs]
  658. type = "http"
  659. url = "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT"
  660. [mcp_servers.safeoutputs.headers]
  661. Authorization = "$GH_AW_SAFE_OUTPUTS_API_KEY"
  662. [mcp_servers.safeoutputs."guard-policies"]
  663. [mcp_servers.safeoutputs."guard-policies".write-sink]
  664. accept = ["*"]
  665. GH_AW_MCP_CONFIG_0ea6235960c71f1a_EOF
  666. # Generate JSON config for MCP gateway
  667. GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node)
  668. cat << GH_AW_MCP_CONFIG_0ea6235960c71f1a_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs"
  669. {
  670. "mcpServers": {
  671. "github": {
  672. "container": "ghcr.io/github/github-mcp-server:v1.1.0",
  673. "env": {
  674. "GITHUB_HOST": "$GITHUB_SERVER_URL",
  675. "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_MCP_SERVER_TOKEN",
  676. "GITHUB_READ_ONLY": "1",
  677. "GITHUB_TOOLSETS": "context,repos,issues,pull_requests"
  678. },
  679. "guard-policies": {
  680. "allow-only": {
  681. "approval-labels": ${{ steps.parse-guard-vars.outputs.approval_labels }},
  682. "blocked-users": ${{ steps.parse-guard-vars.outputs.blocked_users }},
  683. "min-integrity": "none",
  684. "repos": "all",
  685. "trusted-users": ${{ steps.parse-guard-vars.outputs.trusted_users }}
  686. }
  687. }
  688. },
  689. "safeoutputs": {
  690. "type": "http",
  691. "url": "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT",
  692. "headers": {
  693. "Authorization": "$GH_AW_SAFE_OUTPUTS_API_KEY"
  694. },
  695. "guard-policies": {
  696. "write-sink": {
  697. "accept": [
  698. "*"
  699. ]
  700. }
  701. }
  702. }
  703. },
  704. "gateway": {
  705. "port": $MCP_GATEWAY_PORT,
  706. "domain": "${MCP_GATEWAY_DOMAIN}",
  707. "apiKey": "${MCP_GATEWAY_API_KEY}",
  708. "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}"
  709. }
  710. }
  711. GH_AW_MCP_CONFIG_0ea6235960c71f1a_EOF
  712. # Sync converter output to writable CODEX_HOME for Codex
  713. mkdir -p /tmp/gh-aw/mcp-config
  714. cat > "/tmp/gh-aw/mcp-config/config.toml" << GH_AW_CODEX_SHELL_POLICY_cf03d3ed3eea1dd3_EOF
  715. model_provider = "openai-proxy"
  716. [model_providers.openai-proxy]
  717. name = "OpenAI AWF proxy"
  718. base_url = "http://172.30.0.30:10000"
  719. env_key = "OPENAI_API_KEY"
  720. supports_websockets = false
  721. [shell_environment_policy]
  722. inherit = "core"
  723. 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$"]
  724. GH_AW_CODEX_SHELL_POLICY_cf03d3ed3eea1dd3_EOF
  725. awk '
  726. BEGIN { skip_openai_proxy = 0 }
  727. /^[[:space:]]*model_provider[[:space:]]*=/ { next }
  728. /^\[model_providers\.openai-proxy\][[:space:]]*$/ { skip_openai_proxy = 1; next }
  729. /^\[/ { skip_openai_proxy = 0 }
  730. !skip_openai_proxy { print }
  731. ' "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" >> "/tmp/gh-aw/mcp-config/config.toml"
  732. chmod 600 "/tmp/gh-aw/mcp-config/config.toml"
  733. mkdir -p "${CODEX_HOME}"
  734. if [ "/tmp/gh-aw/mcp-config/config.toml" != "${CODEX_HOME}/config.toml" ]; then cp "/tmp/gh-aw/mcp-config/config.toml" "${CODEX_HOME}/config.toml"; fi
  735. chmod 600 "${CODEX_HOME}/config.toml"
  736. - name: Mount MCP servers as CLIs
  737. id: mount-mcp-clis
  738. continue-on-error: true
  739. env:
  740. MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }}
  741. MCP_GATEWAY_DOMAIN: ${{ steps.start-mcp-gateway.outputs.gateway-domain }}
  742. MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }}
  743. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  744. with:
  745. script: |
  746. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  747. setupGlobals(core, github, context, exec, io);
  748. const { main } = require('${{ runner.temp }}/gh-aw/actions/mount_mcp_as_cli.cjs');
  749. await main();
  750. - name: Clean credentials
  751. continue-on-error: true
  752. run: bash "${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh"
  753. - name: Audit pre-agent workspace
  754. id: pre_agent_audit
  755. continue-on-error: true
  756. run: bash "${RUNNER_TEMP}/gh-aw/actions/audit_pre_agent_workspace.sh"
  757. - name: Execute Codex CLI
  758. id: agentic_execution
  759. run: |
  760. set -o pipefail
  761. printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt
  762. mkdir -p "$CODEX_HOME/logs" && touch /tmp/gh-aw/agent-step-summary.md
  763. (umask 177 && touch /tmp/gh-aw/agent-stdio.log)
  764. printf '%s\n' '{"$schema":"https://github.com/github/gh-aw-firewall/releases/download/v0.25.58/awf-config.schema.json","network":{"allowDomains":["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","chatgpt.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"]},"apiProxy":{"enabled":true,"enableTokenSteering":true,"maxRuns":500,"maxEffectiveTokens":25000000,"targets":{"openai":{"host":"ai-pixel.online"}},"models":{"agent":["sonnet-6x","gpt-5.4","gpt-5.3","gemini-pro","any"],"antigravity":["copilot/antigravity*","google/antigravity*","gemini/antigravity*"],"any":["copilot/*","anthropic/*","openai/*","google/*","gemini/*"],"claude":["agent"],"codex":["agent"],"coding":["copilot/gpt-5*codex*","openai/gpt-5*codex*","gpt-5-codex"],"computer-use":["copilot/*computer-use*","google/*computer-use*","gemini/*computer-use*","openai/*computer-use*"],"copilot":["agent"],"deep-research":["copilot/deep-research*","copilot/o3-deep-research*","copilot/o4-mini-deep-research*","google/deep-research*","gemini/deep-research*","openai/o3-deep-research*","openai/o4-mini-deep-research*"],"gemini":["agent"],"gemini-3-flash":["copilot/gemini-3*flash*","google/gemini-3*flash*","gemini/gemini-3*flash*"],"gemini-3-pro":["copilot/gemini-3*pro*","google/gemini-3*pro*","gemini/gemini-3*pro*"],"gemini-3.1-flash":["copilot/gemini-3.1*flash*","google/gemini-3.1*flash*","gemini/gemini-3.1*flash*"],"gemini-3.1-pro":["copilot/gemini-3.1*pro*","google/gemini-3.1*pro*","gemini/gemini-3.1*pro*"],"gemini-3.5-flash":["copilot/gemini-3.5*flash*","google/gemini-3.5*flash*","gemini/gemini-3.5*flash*"],"gemini-flash":["copilot/gemini-*flash*","google/gemini-*flash*","gemini/gemini-*flash*"],"gemini-flash-lite":["copilot/gemini-*flash*lite*","google/gemini-*flash*lite*","gemini/gemini-*flash*lite*"],"gemini-pro":["copilot/gemini-*pro*","google/gemini-*pro*","gemini/gemini-*pro*"],"gemma":["copilot/gemma*","google/gemma*","gemini/gemma*"],"gpt-5":["copilot/gpt-5*","openai/gpt-5*"],"gpt-5-codex":["copilot/gpt-5*codex*","openai/gpt-5*codex*"],"gpt-5-mini":["copilot/gpt-5*mini*","openai/gpt-5*mini*"],"gpt-5-nano":["copilot/gpt-5*nano*","openai/gpt-5*nano*"],"gpt-5-pro":["copilot/gpt-5*pro*","openai/gpt-5*pro*"],"gpt-5.2":["copilot/gpt-5.2*","openai/gpt-5.2*"],"gpt-5.3":["copilot/gpt-5.3*","openai/gpt-5.3*"],"gpt-5.4":["copilot/gpt-5.4*","openai/gpt-5.4*"],"gpt-5.5":["copilot/gpt-5.5*","openai/gpt-5.5*"],"haiku":["copilot/*haiku*","anthropic/*haiku*"],"large":["sonnet","gpt-5-pro","gpt-5","gemini-pro"],"mini":["haiku","gpt-5-mini","gpt-5-nano","gemini-flash-lite"],"opus":["copilot/*opus*","anthropic/*opus*"],"opusplan":["opus?effort=high"],"reasoning":["copilot/o1*","copilot/o3*","copilot/o4*","openai/o1*","openai/o3*","openai/o4*"],"robotics":["copilot/*robotics*","google/*robotics*","gemini/*robotics*"],"small":["mini"],"sonnet":["copilot/*sonnet*","anthropic/*sonnet*"],"sonnet-6x":["copilot/*sonnet-4-5-*","anthropic/*sonnet-4-5-*","copilot/*sonnet-4-6*","anthropic/*sonnet-4-6*"],"summarization":["haiku","gpt-5-mini","gemini-flash-lite","mini"],"vision":["copilot/gemini-*image*","gemini/gemini-*image*","copilot/gemini-*flash*","gemini/gemini-*flash*"]}},"container":{"imageTag":"0.25.58"}}' > "${RUNNER_TEMP}/gh-aw/awf-config.json"
  765. GH_AW_MODEL_MULTIPLIERS_PATH="/tmp/gh-aw/model_multipliers.json" node "${RUNNER_TEMP}/gh-aw/actions/merge_awf_model_multipliers.cjs"
  766. cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json
  767. GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS=""
  768. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  769. GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="--docker-host-path-prefix /tmp/gh-aw"
  770. fi
  771. GH_AW_TOOL_CACHE_MOUNT=""
  772. GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:-/opt/hostedtoolcache}"
  773. if [ -d "$GH_AW_TOOL_CACHE" ]; then
  774. if [[ "$GH_AW_TOOL_CACHE" != /opt/* ]]; then
  775. GH_AW_TOOL_CACHE_MOUNT="$GH_AW_TOOL_CACHE:$GH_AW_TOOL_CACHE:ro"
  776. fi
  777. elif [ -d "/home/runner/work/_tool" ]; then
  778. GH_AW_TOOL_CACHE_MOUNT="/home/runner/work/_tool:/home/runner/work/_tool:ro"
  779. fi
  780. # shellcheck disable=SC1003
  781. sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS} --env-all --exclude-env CODEX_API_KEY --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --exclude-env OPENAI_API_KEY --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull \
  782. -- /bin/bash -c 'set +o histexpand; export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:-/opt/hostedtoolcache}"; export PATH="$(find "$GH_AW_TOOL_CACHE" /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/codex_harness.cjs codex exec${GH_AW_MODEL_AGENT_CODEX:+ --model "$GH_AW_MODEL_AGENT_CODEX"} -c web_search="disabled" -c fetch="disabled" --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log
  783. env:
  784. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }}
  785. CODEX_HOME: /tmp/gh-aw/mcp-config
  786. GH_AW_MCP_CONFIG: ${{ runner.temp }}/gh-aw/mcp-config/config.toml
  787. GH_AW_MODEL_AGENT_CODEX: gpt-5.4
  788. GH_AW_PHASE: agent
  789. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  790. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  791. GH_AW_VERSION: v0.77.5
  792. GITHUB_AW: true
  793. GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
  794. GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
  795. GIT_AUTHOR_NAME: github-actions[bot]
  796. GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
  797. GIT_COMMITTER_NAME: github-actions[bot]
  798. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  799. OPENAI_BASE_URL: https://ai-pixel.online
  800. RUNNER_TEMP: ${{ runner.temp }}
  801. RUST_LOG: ${{ runner.debug == 1 && 'trace,hyper_util=info,mio=info,reqwest=info,os_info=info,codex_otel=warn,codex_core=debug,ocodex_exec=debug' || 'warn' }}
  802. - name: Configure Git credentials
  803. env:
  804. REPO_NAME: ${{ github.repository }}
  805. SERVER_URL: ${{ github.server_url }}
  806. GITHUB_TOKEN: ${{ github.token }}
  807. run: |
  808. git config --global user.email "github-actions[bot]@users.noreply.github.com"
  809. git config --global user.name "github-actions[bot]"
  810. git config --global am.keepcr true
  811. # Re-authenticate git with GitHub token
  812. SERVER_URL_STRIPPED="${SERVER_URL#https://}"
  813. git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
  814. echo "Git configured with standard GitHub Actions identity"
  815. - name: Stop MCP Gateway
  816. if: always()
  817. continue-on-error: true
  818. env:
  819. MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }}
  820. MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }}
  821. GATEWAY_PID: ${{ steps.start-mcp-gateway.outputs.gateway-pid }}
  822. run: |
  823. bash "${RUNNER_TEMP}/gh-aw/actions/stop_mcp_gateway.sh" "$GATEWAY_PID"
  824. - name: Redact secrets in logs
  825. if: always()
  826. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  827. with:
  828. script: |
  829. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  830. setupGlobals(core, github, context, exec, io, getOctokit);
  831. const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs');
  832. await main();
  833. env:
  834. 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'
  835. SECRET_CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
  836. SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
  837. SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
  838. SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  839. SECRET_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  840. SECRET_PIXEL_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  841. - name: Append agent step summary
  842. if: always()
  843. run: bash "${RUNNER_TEMP}/gh-aw/actions/append_agent_step_summary.sh"
  844. - name: Copy Safe Outputs
  845. if: always()
  846. env:
  847. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  848. run: |
  849. mkdir -p /tmp/gh-aw
  850. cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true
  851. - name: Ingest agent output
  852. id: collect_output
  853. if: always()
  854. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  855. env:
  856. GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
  857. 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,chatgpt.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"
  858. GH_AW_ALLOWED_GITHUB_REFS: ""
  859. GITHUB_SERVER_URL: ${{ github.server_url }}
  860. GITHUB_API_URL: ${{ github.api_url }}
  861. with:
  862. script: |
  863. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  864. setupGlobals(core, github, context, exec, io, getOctokit);
  865. const { main } = require('${{ runner.temp }}/gh-aw/actions/collect_ndjson_output.cjs');
  866. await main();
  867. - name: Parse agent logs for step summary
  868. if: always()
  869. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  870. env:
  871. GH_AW_AGENT_OUTPUT: /tmp/gh-aw/agent-stdio.log
  872. with:
  873. script: |
  874. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  875. setupGlobals(core, github, context, exec, io, getOctokit);
  876. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_codex_log.cjs');
  877. await main();
  878. - name: Parse MCP Gateway logs for step summary
  879. if: always()
  880. id: parse-mcp-gateway
  881. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  882. with:
  883. script: |
  884. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  885. setupGlobals(core, github, context, exec, io, getOctokit);
  886. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_mcp_gateway_log.cjs');
  887. await main();
  888. - name: Print firewall logs
  889. if: always()
  890. continue-on-error: true
  891. env:
  892. AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs
  893. run: |
  894. # Fix permissions on firewall logs/audit dirs so they can be uploaded as artifacts
  895. # AWF runs with sudo, creating files owned by root
  896. sudo chmod -R a+rX /tmp/gh-aw/sandbox/firewall 2>/dev/null || true
  897. # Only run awf logs summary if awf command exists (it may not be installed if workflow failed before install step)
  898. if command -v awf &> /dev/null; then
  899. awf logs summary | tee -a "$GITHUB_STEP_SUMMARY"
  900. else
  901. echo 'AWF binary not installed, skipping firewall log summary'
  902. fi
  903. - name: Parse token usage for step summary
  904. if: always()
  905. continue-on-error: true
  906. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  907. with:
  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/parse_token_usage.cjs');
  912. await main();
  913. - name: Print AWF reflect summary
  914. if: always()
  915. continue-on-error: true
  916. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  917. with:
  918. script: |
  919. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  920. setupGlobals(core, github, context, exec, io, getOctokit);
  921. const { main } = require('${{ runner.temp }}/gh-aw/actions/awf_reflect_summary.cjs');
  922. await main();
  923. - name: Write agent output placeholder if missing
  924. if: always()
  925. run: |
  926. if [ ! -f /tmp/gh-aw/agent_output.json ]; then
  927. echo '{"items":[]}' > /tmp/gh-aw/agent_output.json
  928. fi
  929. - name: Upload agent artifacts
  930. if: always()
  931. continue-on-error: true
  932. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  933. with:
  934. name: agent
  935. path: |
  936. /tmp/gh-aw/aw-prompts/prompt.txt
  937. /tmp/gh-aw/mcp-config/logs/
  938. /tmp/gh-aw/redacted-urls.log
  939. /tmp/gh-aw/mcp-logs/
  940. /tmp/gh-aw/proxy-logs/
  941. !/tmp/gh-aw/proxy-logs/proxy-tls/
  942. /tmp/gh-aw/agent_usage.json
  943. /tmp/gh-aw/agent-stdio.log
  944. /tmp/gh-aw/pre-agent-audit.txt
  945. /tmp/gh-aw/agent/
  946. /tmp/gh-aw/github_rate_limits.jsonl
  947. /tmp/gh-aw/safeoutputs.jsonl
  948. /tmp/gh-aw/agent_output.json
  949. /tmp/gh-aw/aw-*.patch
  950. /tmp/gh-aw/aw-*.bundle
  951. /tmp/gh-aw/awf-config.json
  952. /tmp/gh-aw/sandbox/firewall/logs/
  953. /tmp/gh-aw/sandbox/firewall/audit/
  954. /tmp/gh-aw/sandbox/firewall/awf-reflect.json
  955. if-no-files-found: ignore
  956. conclusion:
  957. needs:
  958. - activation
  959. - agent
  960. - detection
  961. - safe_outputs
  962. if: >
  963. always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true' ||
  964. needs.activation.outputs.stale_lock_file_failed == 'true')
  965. runs-on: ubuntu-slim
  966. permissions:
  967. contents: read
  968. issues: write
  969. concurrency:
  970. group: "gh-aw-conclusion-weekly-report"
  971. cancel-in-progress: false
  972. queue: max
  973. outputs:
  974. incomplete_count: ${{ steps.report_incomplete.outputs.incomplete_count }}
  975. noop_message: ${{ steps.noop.outputs.noop_message }}
  976. tools_reported: ${{ steps.missing_tool.outputs.tools_reported }}
  977. total_count: ${{ steps.missing_tool.outputs.total_count }}
  978. steps:
  979. - name: Setup Scripts
  980. id: setup
  981. uses: github/gh-aw-actions/setup@3ea13c02d765410340d533515cb31a7eef2baaf0 # v0.77.5
  982. with:
  983. destination: ${{ runner.temp }}/gh-aw/actions
  984. job-name: ${{ github.job }}
  985. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  986. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  987. env:
  988. GH_AW_SETUP_WORKFLOW_NAME: "Weekly Report"
  989. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/weekly-report.lock.yml@${{ github.ref }}
  990. GH_AW_INFO_VERSION: "0.135.0"
  991. GH_AW_INFO_AWF_VERSION: "v0.25.58"
  992. GH_AW_INFO_ENGINE_ID: "codex"
  993. - name: Download agent output artifact
  994. id: download-agent-output
  995. continue-on-error: true
  996. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  997. with:
  998. name: agent
  999. path: /tmp/gh-aw/
  1000. - name: Setup agent output environment variable
  1001. id: setup-agent-output-env
  1002. if: steps.download-agent-output.outcome == 'success'
  1003. run: |
  1004. mkdir -p /tmp/gh-aw/
  1005. find "/tmp/gh-aw/" -type f -print
  1006. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1007. - name: Process no-op messages
  1008. id: noop
  1009. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1010. env:
  1011. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1012. GH_AW_NOOP_MAX: "1"
  1013. GH_AW_WORKFLOW_NAME: "Weekly Report"
  1014. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/weekly-report.md"
  1015. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1016. GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
  1017. GH_AW_NOOP_REPORT_AS_ISSUE: "true"
  1018. with:
  1019. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1020. script: |
  1021. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1022. setupGlobals(core, github, context, exec, io, getOctokit);
  1023. const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_noop_message.cjs');
  1024. await main();
  1025. - name: Log detection run
  1026. id: detection_runs
  1027. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1028. env:
  1029. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1030. GH_AW_WORKFLOW_NAME: "Weekly Report"
  1031. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/weekly-report.md"
  1032. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1033. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  1034. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  1035. with:
  1036. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1037. script: |
  1038. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1039. setupGlobals(core, github, context, exec, io, getOctokit);
  1040. const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_detection_runs.cjs');
  1041. await main();
  1042. - name: Record missing tool
  1043. id: missing_tool
  1044. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1045. env:
  1046. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1047. GH_AW_MISSING_TOOL_CREATE_ISSUE: "true"
  1048. GH_AW_WORKFLOW_NAME: "Weekly Report"
  1049. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/weekly-report.md"
  1050. with:
  1051. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1052. script: |
  1053. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1054. setupGlobals(core, github, context, exec, io, getOctokit);
  1055. const { main } = require('${{ runner.temp }}/gh-aw/actions/missing_tool.cjs');
  1056. await main();
  1057. - name: Record incomplete
  1058. id: report_incomplete
  1059. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1060. env:
  1061. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1062. GH_AW_REPORT_INCOMPLETE_CREATE_ISSUE: "true"
  1063. GH_AW_WORKFLOW_NAME: "Weekly Report"
  1064. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/weekly-report.md"
  1065. with:
  1066. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1067. script: |
  1068. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1069. setupGlobals(core, github, context, exec, io, getOctokit);
  1070. const { main } = require('${{ runner.temp }}/gh-aw/actions/report_incomplete_handler.cjs');
  1071. await main();
  1072. - name: Handle agent failure
  1073. id: handle_agent_failure
  1074. if: always()
  1075. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1076. env:
  1077. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1078. GH_AW_WORKFLOW_NAME: "Weekly Report"
  1079. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/weekly-report.md"
  1080. GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
  1081. GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
  1082. GH_AW_WORKFLOW_ID: "weekly-report"
  1083. GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168"
  1084. GH_AW_ENGINE_ID: "codex"
  1085. GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }}
  1086. GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }}
  1087. GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }}
  1088. GH_AW_EFFECTIVE_TOKENS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.effective_tokens_rate_limit_error || 'false' }}
  1089. GH_AW_ENGINE_API_HOSTS: "api.openai.com"
  1090. GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }}
  1091. GH_AW_STALE_LOCK_FILE_FAILED: ${{ needs.activation.outputs.stale_lock_file_failed }}
  1092. GH_AW_GROUP_REPORTS: "false"
  1093. GH_AW_FAILURE_REPORT_AS_ISSUE: "true"
  1094. GH_AW_MISSING_TOOL_REPORT_AS_FAILURE: "true"
  1095. GH_AW_MISSING_DATA_REPORT_AS_FAILURE: "true"
  1096. GH_AW_TIMEOUT_MINUTES: "20"
  1097. GH_AW_MAX_EFFECTIVE_TOKENS: "25000000"
  1098. with:
  1099. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1100. script: |
  1101. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1102. setupGlobals(core, github, context, exec, io, getOctokit);
  1103. const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_agent_failure.cjs');
  1104. await main();
  1105. detection:
  1106. needs:
  1107. - activation
  1108. - agent
  1109. if: >
  1110. always() && needs.agent.result != 'skipped' && (needs.agent.outputs.output_types != '' || needs.agent.outputs.has_patch == 'true')
  1111. runs-on: ubuntu-latest
  1112. permissions:
  1113. contents: read
  1114. outputs:
  1115. detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
  1116. detection_reason: ${{ steps.detection_conclusion.outputs.reason }}
  1117. detection_success: ${{ steps.detection_conclusion.outputs.success }}
  1118. steps:
  1119. - name: Setup Scripts
  1120. id: setup
  1121. uses: github/gh-aw-actions/setup@3ea13c02d765410340d533515cb31a7eef2baaf0 # v0.77.5
  1122. with:
  1123. destination: ${{ runner.temp }}/gh-aw/actions
  1124. job-name: ${{ github.job }}
  1125. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1126. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  1127. env:
  1128. GH_AW_SETUP_WORKFLOW_NAME: "Weekly Report"
  1129. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/weekly-report.lock.yml@${{ github.ref }}
  1130. GH_AW_INFO_VERSION: "0.135.0"
  1131. GH_AW_INFO_AWF_VERSION: "v0.25.58"
  1132. GH_AW_INFO_ENGINE_ID: "codex"
  1133. - name: Download agent output artifact
  1134. id: download-agent-output
  1135. continue-on-error: true
  1136. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1137. with:
  1138. name: agent
  1139. path: /tmp/gh-aw/
  1140. - name: Setup agent output environment variable
  1141. id: setup-agent-output-env
  1142. if: steps.download-agent-output.outcome == 'success'
  1143. run: |
  1144. mkdir -p /tmp/gh-aw/
  1145. find "/tmp/gh-aw/" -type f -print
  1146. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1147. - name: Checkout repository for patch context
  1148. if: needs.agent.outputs.has_patch == 'true'
  1149. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  1150. with:
  1151. persist-credentials: false
  1152. # --- Threat Detection ---
  1153. - name: Clean stale firewall files from agent artifact
  1154. run: |
  1155. rm -rf /tmp/gh-aw/sandbox/firewall/logs
  1156. rm -rf /tmp/gh-aw/sandbox/firewall/audit
  1157. - name: Check if detection needed
  1158. id: detection_guard
  1159. if: always()
  1160. env:
  1161. OUTPUT_TYPES: ${{ needs.agent.outputs.output_types }}
  1162. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1163. run: |
  1164. if [[ -n "$OUTPUT_TYPES" || "$HAS_PATCH" == "true" ]]; then
  1165. echo "run_detection=true" >> "$GITHUB_OUTPUT"
  1166. echo "Detection will run: output_types=$OUTPUT_TYPES, has_patch=$HAS_PATCH"
  1167. else
  1168. echo "run_detection=false" >> "$GITHUB_OUTPUT"
  1169. echo "Detection skipped: no agent outputs or patches to analyze"
  1170. fi
  1171. - name: Clear MCP Config for detection
  1172. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1173. run: |
  1174. rm -f "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json"
  1175. rm -f /home/runner/.copilot/mcp-config.json
  1176. rm -f "$GITHUB_WORKSPACE/.gemini/settings.json"
  1177. - name: Prepare threat detection files
  1178. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1179. run: |
  1180. mkdir -p /tmp/gh-aw/threat-detection/aw-prompts
  1181. cp /tmp/gh-aw/aw-prompts/prompt.txt /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt 2>/dev/null || true
  1182. if [ ! -s /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt ]; then
  1183. echo "::warning::ERR_VALIDATION: Missing or empty detection context prompt at /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt. Ensure the agent artifact includes /tmp/gh-aw/aw-prompts/prompt.txt. Detection will continue with fallback workflow context."
  1184. fi
  1185. cp /tmp/gh-aw/agent_output.json /tmp/gh-aw/threat-detection/agent_output.json 2>/dev/null || true
  1186. for f in /tmp/gh-aw/aw-*.patch; do
  1187. [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true
  1188. done
  1189. for f in /tmp/gh-aw/aw-*.bundle; do
  1190. [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true
  1191. done
  1192. echo "Prepared threat detection files:"
  1193. ls -la /tmp/gh-aw/threat-detection/ 2>/dev/null || true
  1194. - name: Setup threat detection
  1195. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1196. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1197. env:
  1198. WORKFLOW_NAME: "Weekly Report"
  1199. WORKFLOW_DESCRIPTION: "每周自动生成仓库活动报告,包括 PR/Issue 列表、Changelog、贡献者统计等"
  1200. HAS_PATCH: ${{ needs.agent.outputs.has_patch }}
  1201. with:
  1202. script: |
  1203. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1204. setupGlobals(core, github, context, exec, io, getOctokit);
  1205. const { main } = require('${{ runner.temp }}/gh-aw/actions/setup_threat_detection.cjs');
  1206. await main();
  1207. - name: Ensure threat-detection directory and log
  1208. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1209. run: |
  1210. mkdir -p /tmp/gh-aw/threat-detection
  1211. touch /tmp/gh-aw/threat-detection/detection.log
  1212. - name: Setup Node.js
  1213. uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
  1214. with:
  1215. node-version: '24'
  1216. package-manager-cache: false
  1217. - name: Install Codex CLI
  1218. run: npm install --ignore-scripts -g @openai/codex@0.135.0
  1219. - name: Install AWF binary
  1220. run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.58
  1221. - name: Download container images
  1222. run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.58 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.58 ghcr.io/github/gh-aw-firewall/squid:0.25.58 ghcr.io/github/gh-aw-mcpg:v0.3.22
  1223. - name: Start MCP Gateway
  1224. id: start-mcp-gateway
  1225. env:
  1226. CODEX_HOME: /tmp/gh-aw/mcp-config
  1227. run: |
  1228. set -eo pipefail
  1229. mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config"
  1230. # Export gateway environment variables for MCP config and gateway script
  1231. export MCP_GATEWAY_PORT="8080"
  1232. export MCP_GATEWAY_DOMAIN="host.docker.internal"
  1233. export MCP_GATEWAY_HOST_DOMAIN="localhost"
  1234. MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
  1235. echo "::add-mask::${MCP_GATEWAY_API_KEY}"
  1236. export MCP_GATEWAY_API_KEY
  1237. export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads"
  1238. mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}"
  1239. export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288"
  1240. export DEBUG="*"
  1241. export GH_AW_ENGINE="codex"
  1242. MCP_GATEWAY_UID=$(id -u 2>/dev/null || echo '0')
  1243. MCP_GATEWAY_GID=$(id -g 2>/dev/null || echo '0')
  1244. case "${DOCKER_HOST:-}" in
  1245. unix://* ) DOCKER_SOCK_PATH="${DOCKER_HOST#unix://}" ;;
  1246. /* ) DOCKER_SOCK_PATH="$DOCKER_HOST" ;;
  1247. * ) DOCKER_SOCK_PATH=/var/run/docker.sock ;;
  1248. esac
  1249. DOCKER_SOCK_GID=$(stat -c '%g' "$DOCKER_SOCK_PATH" 2>/dev/null || echo '0')
  1250. export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host --add-host host.docker.internal:127.0.0.1 --user '"${MCP_GATEWAY_UID}"':'"${MCP_GATEWAY_GID}"' --group-add '"${DOCKER_SOCK_GID}"' -v '"${DOCKER_SOCK_PATH}"':/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DOCKER_HOST=unix:///var/run/docker.sock -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_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 CODEX_HOME -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.3.22'
  1251. cat > "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" << GH_AW_MCP_CONFIG_a65209eb6d2754ac_EOF
  1252. [history]
  1253. persistence = "none"
  1254. [shell_environment_policy]
  1255. inherit = "core"
  1256. include_only = ["^CODEX_API_KEY$", "^HOME$", "^OPENAI_API_KEY$", "^PATH$"]
  1257. GH_AW_MCP_CONFIG_a65209eb6d2754ac_EOF
  1258. # Generate JSON config for MCP gateway
  1259. GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node)
  1260. cat << GH_AW_MCP_CONFIG_1717310a241604a1_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs"
  1261. {
  1262. "mcpServers": {
  1263. },
  1264. "gateway": {
  1265. "port": $MCP_GATEWAY_PORT,
  1266. "domain": "${MCP_GATEWAY_DOMAIN}",
  1267. "apiKey": "${MCP_GATEWAY_API_KEY}",
  1268. "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}"
  1269. }
  1270. }
  1271. GH_AW_MCP_CONFIG_1717310a241604a1_EOF
  1272. # Sync converter output to writable CODEX_HOME for Codex
  1273. mkdir -p /tmp/gh-aw/mcp-config
  1274. cat > "/tmp/gh-aw/mcp-config/config.toml" << GH_AW_CODEX_SHELL_POLICY_ab443ac5356a1489_EOF
  1275. model_provider = "openai-proxy"
  1276. [model_providers.openai-proxy]
  1277. name = "OpenAI AWF proxy"
  1278. base_url = "http://172.30.0.30:10000"
  1279. env_key = "OPENAI_API_KEY"
  1280. supports_websockets = false
  1281. [shell_environment_policy]
  1282. inherit = "core"
  1283. include_only = ["^CODEX_API_KEY$", "^HOME$", "^OPENAI_API_KEY$", "^PATH$"]
  1284. GH_AW_CODEX_SHELL_POLICY_ab443ac5356a1489_EOF
  1285. awk '
  1286. BEGIN { skip_openai_proxy = 0 }
  1287. /^[[:space:]]*model_provider[[:space:]]*=/ { next }
  1288. /^\[model_providers\.openai-proxy\][[:space:]]*$/ { skip_openai_proxy = 1; next }
  1289. /^\[/ { skip_openai_proxy = 0 }
  1290. !skip_openai_proxy { print }
  1291. ' "${RUNNER_TEMP}/gh-aw/mcp-config/config.toml" >> "/tmp/gh-aw/mcp-config/config.toml"
  1292. chmod 600 "/tmp/gh-aw/mcp-config/config.toml"
  1293. mkdir -p "${CODEX_HOME}"
  1294. if [ "/tmp/gh-aw/mcp-config/config.toml" != "${CODEX_HOME}/config.toml" ]; then cp "/tmp/gh-aw/mcp-config/config.toml" "${CODEX_HOME}/config.toml"; fi
  1295. chmod 600 "${CODEX_HOME}/config.toml"
  1296. - name: Execute Codex CLI
  1297. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1298. continue-on-error: true
  1299. id: detection_agentic_execution
  1300. run: |
  1301. set -o pipefail
  1302. printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt
  1303. mkdir -p "$CODEX_HOME/logs" && touch /tmp/gh-aw/agent-step-summary.md && mkdir -p /tmp/gh-aw/threat-detection && printf '%s' '{"type":"object","properties":{"prompt_injection":{"type":"boolean"},"secret_leak":{"type":"boolean"},"malicious_patch":{"type":"boolean"},"reasons":{"type":"array","items":{"type":"string"}}},"required":["prompt_injection","secret_leak","malicious_patch","reasons"],"additionalProperties":false}' > /tmp/gh-aw/threat-detection/detection_schema.json
  1304. (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log)
  1305. printf '%s\n' '{"$schema":"https://github.com/github/gh-aw-firewall/releases/download/v0.25.58/awf-config.schema.json","network":{"allowDomains":["172.30.0.1","api.openai.com","chatgpt.com","host.docker.internal","openai.com"]},"apiProxy":{"enabled":true,"enableTokenSteering":true,"maxRuns":500,"maxEffectiveTokens":25000000,"targets":{"openai":{"host":"ai-pixel.online"}}},"container":{"imageTag":"0.25.58"}}' > "${RUNNER_TEMP}/gh-aw/awf-config.json"
  1306. GH_AW_MODEL_MULTIPLIERS_PATH="/tmp/gh-aw/model_multipliers.json" node "${RUNNER_TEMP}/gh-aw/actions/merge_awf_model_multipliers.cjs"
  1307. cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json
  1308. GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS=""
  1309. if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then
  1310. GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="--docker-host-path-prefix /tmp/gh-aw"
  1311. fi
  1312. GH_AW_TOOL_CACHE_MOUNT=""
  1313. GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:-/opt/hostedtoolcache}"
  1314. if [ -d "$GH_AW_TOOL_CACHE" ]; then
  1315. if [[ "$GH_AW_TOOL_CACHE" != /opt/* ]]; then
  1316. GH_AW_TOOL_CACHE_MOUNT="$GH_AW_TOOL_CACHE:$GH_AW_TOOL_CACHE:ro"
  1317. fi
  1318. elif [ -d "/home/runner/work/_tool" ]; then
  1319. GH_AW_TOOL_CACHE_MOUNT="/home/runner/work/_tool:/home/runner/work/_tool:ro"
  1320. fi
  1321. # shellcheck disable=SC1003
  1322. sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_TOOL_CACHE_MOUNT:+--mount "$GH_AW_TOOL_CACHE_MOUNT"} ${GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS} --env-all --exclude-env CODEX_API_KEY --exclude-env OPENAI_API_KEY --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull \
  1323. -- /bin/bash -c 'set +o histexpand; GH_AW_TOOL_CACHE="${RUNNER_TOOL_CACHE:-/opt/hostedtoolcache}"; export PATH="$(find "$GH_AW_TOOL_CACHE" /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/codex_harness.cjs codex exec${GH_AW_MODEL_DETECTION_CODEX:+ --model "$GH_AW_MODEL_DETECTION_CODEX"} -c web_search="disabled" -c fetch="disabled" --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check --output-schema /tmp/gh-aw/threat-detection/detection_schema.json -o /tmp/gh-aw/threat-detection/detection_result.json --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log
  1324. env:
  1325. CODEX_API_KEY: ${{ secrets.CODEX_API_KEY || secrets.OPENAI_API_KEY }}
  1326. CODEX_HOME: /tmp/gh-aw/mcp-config
  1327. GH_AW_MCP_CONFIG: ${{ runner.temp }}/gh-aw/mcp-config/config.toml
  1328. GH_AW_MODEL_DETECTION_CODEX: gpt-5.4
  1329. GH_AW_PHASE: detection
  1330. GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
  1331. GH_AW_VERSION: v0.77.5
  1332. GITHUB_AW: true
  1333. GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
  1334. GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
  1335. GIT_AUTHOR_NAME: github-actions[bot]
  1336. GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
  1337. GIT_COMMITTER_NAME: github-actions[bot]
  1338. OPENAI_API_KEY: ${{ secrets.PIXEL_API_KEY }}
  1339. OPENAI_BASE_URL: https://ai-pixel.online
  1340. RUNNER_TEMP: ${{ runner.temp }}
  1341. RUST_LOG: ${{ runner.debug == 1 && 'trace,hyper_util=info,mio=info,reqwest=info,os_info=info,codex_otel=warn,codex_core=debug,ocodex_exec=debug' || 'warn' }}
  1342. - name: Upload threat detection log
  1343. if: always() && steps.detection_guard.outputs.run_detection == 'true'
  1344. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1345. with:
  1346. name: detection
  1347. path: /tmp/gh-aw/threat-detection/detection.log
  1348. if-no-files-found: ignore
  1349. - name: Parse and conclude threat detection
  1350. id: detection_conclusion
  1351. if: always()
  1352. continue-on-error: true
  1353. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1354. env:
  1355. RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
  1356. DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
  1357. GH_AW_DETECTION_CONTINUE_ON_ERROR: "true"
  1358. with:
  1359. script: |
  1360. try {
  1361. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1362. setupGlobals(core, github, context, exec, io, getOctokit);
  1363. const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_threat_detection_results.cjs');
  1364. await main();
  1365. } catch (loadErr) {
  1366. const continueOnError = process.env.GH_AW_DETECTION_CONTINUE_ON_ERROR !== 'false';
  1367. const detectionExecutionFailed = process.env.DETECTION_AGENTIC_EXECUTION_OUTCOME === 'failure';
  1368. const msg = 'ERR_SYSTEM: \u274C Unexpected error loading threat detection module: ' + (loadErr && loadErr.message ? loadErr.message : String(loadErr));
  1369. core.error(msg);
  1370. core.setOutput('reason', 'parse_error');
  1371. if (continueOnError && !detectionExecutionFailed) {
  1372. core.warning('\u26A0\uFE0F ' + msg);
  1373. core.setOutput('conclusion', 'warning');
  1374. core.setOutput('success', 'false');
  1375. } else {
  1376. core.setOutput('conclusion', 'failure');
  1377. core.setOutput('success', 'false');
  1378. core.setFailed(msg);
  1379. }
  1380. }
  1381. safe_outputs:
  1382. needs:
  1383. - activation
  1384. - agent
  1385. - detection
  1386. if: (!cancelled()) && needs.agent.result != 'skipped' && needs.detection.result == 'success'
  1387. runs-on: ubuntu-slim
  1388. permissions:
  1389. contents: read
  1390. issues: write
  1391. timeout-minutes: 15
  1392. env:
  1393. GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/weekly-report"
  1394. GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }}
  1395. GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }}
  1396. GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens }}
  1397. GH_AW_ENGINE_ID: "codex"
  1398. GH_AW_ENGINE_MODEL: "gpt-5.4"
  1399. GH_AW_WORKFLOW_ID: "weekly-report"
  1400. GH_AW_WORKFLOW_NAME: "Weekly Report"
  1401. GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/${{ github.repository }}/blob/${{ github.ref_name }}/.github/workflows/weekly-report.md"
  1402. outputs:
  1403. code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }}
  1404. code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }}
  1405. create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }}
  1406. create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }}
  1407. created_issue_number: ${{ steps.process_safe_outputs.outputs.created_issue_number }}
  1408. created_issue_url: ${{ steps.process_safe_outputs.outputs.created_issue_url }}
  1409. process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }}
  1410. process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }}
  1411. steps:
  1412. - name: Setup Scripts
  1413. id: setup
  1414. uses: github/gh-aw-actions/setup@3ea13c02d765410340d533515cb31a7eef2baaf0 # v0.77.5
  1415. with:
  1416. destination: ${{ runner.temp }}/gh-aw/actions
  1417. job-name: ${{ github.job }}
  1418. trace-id: ${{ needs.activation.outputs.setup-trace-id }}
  1419. parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }}
  1420. env:
  1421. GH_AW_SETUP_WORKFLOW_NAME: "Weekly Report"
  1422. GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/weekly-report.lock.yml@${{ github.ref }}
  1423. GH_AW_INFO_VERSION: "0.135.0"
  1424. GH_AW_INFO_AWF_VERSION: "v0.25.58"
  1425. GH_AW_INFO_ENGINE_ID: "codex"
  1426. - name: Download agent output artifact
  1427. id: download-agent-output
  1428. continue-on-error: true
  1429. uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
  1430. with:
  1431. name: agent
  1432. path: /tmp/gh-aw/
  1433. - name: Setup agent output environment variable
  1434. id: setup-agent-output-env
  1435. if: steps.download-agent-output.outcome == 'success'
  1436. run: |
  1437. mkdir -p /tmp/gh-aw/
  1438. find "/tmp/gh-aw/" -type f -print
  1439. echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT"
  1440. - name: Configure GH_HOST for enterprise compatibility
  1441. id: ghes-host-config
  1442. shell: bash
  1443. run: |
  1444. # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct
  1445. # GitHub instance (GHES/GHEC). On github.com this is a harmless no-op.
  1446. GH_HOST="${GITHUB_SERVER_URL#https://}"
  1447. GH_HOST="${GH_HOST#http://}"
  1448. echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV"
  1449. - name: Process Safe Outputs
  1450. id: process_safe_outputs
  1451. uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
  1452. env:
  1453. GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }}
  1454. GH_AW_COMMENT_ID: ${{ needs.activation.outputs.comment_id }}
  1455. 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,chatgpt.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"
  1456. GITHUB_SERVER_URL: ${{ github.server_url }}
  1457. GITHUB_API_URL: ${{ github.api_url }}
  1458. GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"create_issue\":{\"close_older_issues\":true,\"expires\":720,\"labels\":[\"weekly-report\",\"report\"],\"max\":1,\"title_prefix\":\"Weekly Report: \"},\"create_report_incomplete_issue\":{},\"mentions\":{\"enabled\":false},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"true\"},\"report_incomplete\":{}}"
  1459. with:
  1460. github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
  1461. script: |
  1462. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  1463. setupGlobals(core, github, context, exec, io, getOctokit);
  1464. const { main } = require('${{ runner.temp }}/gh-aw/actions/safe_output_handler_manager.cjs');
  1465. await main();
  1466. - name: Upload Safe Outputs Items
  1467. if: always()
  1468. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
  1469. with:
  1470. name: safe-outputs-items
  1471. path: |
  1472. /tmp/gh-aw/safe-output-items.jsonl
  1473. /tmp/gh-aw/temporary-id-map.json
  1474. if-no-files-found: ignore