weekly-report.lock.yml 98 KB

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