weekly-report.lock.yml 138 KB

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