issue-triage.lock.yml 71 KB

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