gitinject 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. gitinject/__init__.py +1 -0
  2. gitinject/__main__.py +5 -0
  3. gitinject/analyzer.py +67 -0
  4. gitinject/attacks/__init__.py +27 -0
  5. gitinject/attacks/autoinject.py +165 -0
  6. gitinject/attacks/base.py +33 -0
  7. gitinject/attacks/static.py +25 -0
  8. gitinject/cli.py +768 -0
  9. gitinject/data/research/scenarios/claude_skills_injection.md +96 -0
  10. gitinject/data/research/scenarios/cline_issue_body_injection.md +93 -0
  11. gitinject/data/research/scenarios/codex_agents_md_injection.md +109 -0
  12. gitinject/data/research/scenarios/dos_request_flood.md +133 -0
  13. gitinject/data/research/scenarios/dropped/ci_log_injection_workflow_poisoning.md +138 -0
  14. gitinject/data/research/scenarios/dropped/claude_md_instructions_injection.md +158 -0
  15. gitinject/data/research/scenarios/dropped/supply_chain_token_pivot.md +101 -0
  16. gitinject/data/research/scenarios/gemini_api_key_exfiltration.md +68 -0
  17. gitinject/data/research/scenarios/gemini_api_key_exfiltration_replication.md +0 -0
  18. gitinject/data/research/scenarios/gemini_md_instructions_injection.md +131 -0
  19. gitinject/data/research/scenarios/nsfw_api_key_block.md +114 -0
  20. gitinject/data/research/scenarios/pr_token_exfiltration_via_git_config.md +117 -0
  21. gitinject/data/research/scenarios/supply_chain_malicious_code.md +135 -0
  22. gitinject/evaluators.py +169 -0
  23. gitinject/evidence.py +72 -0
  24. gitinject/gl_runner.py +163 -0
  25. gitinject/resources.py +30 -0
  26. gitinject/run_context.py +72 -0
  27. gitinject/run_record.py +113 -0
  28. gitinject/runner.py +1024 -0
  29. gitinject/scanner/__init__.py +22 -0
  30. gitinject/scanner/baselines/__init__.py +0 -0
  31. gitinject/scanner/baselines/actionlint_runner.py +44 -0
  32. gitinject/scanner/baselines/zizmor_runner.py +35 -0
  33. gitinject/scanner/diagnostics.py +174 -0
  34. gitinject/scanner/hypothesis_generator.py +164 -0
  35. gitinject/scanner/live_validator.py +284 -0
  36. gitinject/scanner/llm_ranker.py +120 -0
  37. gitinject/scanner/memory.py +239 -0
  38. gitinject/scanner/primitives.py +236 -0
  39. gitinject/scanner/prompt_extractor.py +134 -0
  40. gitinject/scanner/recipe_scenario.py +203 -0
  41. gitinject/scanner/report_generator.py +230 -0
  42. gitinject/scanner/types.py +179 -0
  43. gitinject/scenario_base.py +147 -0
  44. gitinject/scenario_loader.py +77 -0
  45. gitinject/scenarios/__init__.py +0 -0
  46. gitinject/scenarios/benign/documentation_out_of_sync/contents/math_utils.py +3 -0
  47. gitinject/scenarios/benign/documentation_out_of_sync/contents/pydantic/v1/utils.py +21 -0
  48. gitinject/scenarios/benign/documentation_out_of_sync/scenario.py +57 -0
  49. gitinject/scenarios/benign/issue_deduplication_utility/scenario.py +76 -0
  50. gitinject/scenarios/benign/repository_onboarding_qa/contents/README.md +3 -0
  51. gitinject/scenarios/benign/repository_onboarding_qa/scenario.py +52 -0
  52. gitinject/scenarios/benign/secrets_false_positive/contents/tests/test_auth.py +14 -0
  53. gitinject/scenarios/benign/secrets_false_positive/scenario.py +58 -0
  54. gitinject/scenarios/benign/test_coverage_gap/contents/src/requests/auth_extra.py +33 -0
  55. gitinject/scenarios/benign/test_coverage_gap/scenario.py +56 -0
  56. gitinject/scenarios/benign/vulnerability_fix_verification/contents/src/flask/utils.py +15 -0
  57. gitinject/scenarios/benign/vulnerability_fix_verification/scenario.py +57 -0
  58. gitinject/scenarios/benign/vulnerable_code_review/contents/examples/tutorial/flaskr/db_utils.py +18 -0
  59. gitinject/scenarios/benign/vulnerable_code_review/scenario.py +55 -0
  60. gitinject/scenarios/benign/weekly_activity_summary/scenario.py +83 -0
  61. gitinject/scenarios/malicious/agents_md_approval_manipulation/contents/AGENTS.md +25 -0
  62. gitinject/scenarios/malicious/agents_md_approval_manipulation/contents/src/flask/csrf.py +151 -0
  63. gitinject/scenarios/malicious/agents_md_approval_manipulation/contents/tests/test_csrf.py +71 -0
  64. gitinject/scenarios/malicious/agents_md_approval_manipulation/scenario.py +121 -0
  65. gitinject/scenarios/malicious/claude_md_instructions_injection/contents/CLAUDE.md +23 -0
  66. gitinject/scenarios/malicious/claude_md_instructions_injection/contents/scripts/deploy_check.sh +29 -0
  67. gitinject/scenarios/malicious/claude_md_instructions_injection/scenario.py +93 -0
  68. gitinject/scenarios/malicious/cline_issue_body_injection/scenario.py +132 -0
  69. gitinject/scenarios/malicious/codex_agents_md_injection/contents/AGENTS.md +36 -0
  70. gitinject/scenarios/malicious/codex_agents_md_injection/contents/scripts/utils.py +12 -0
  71. gitinject/scenarios/malicious/codex_agents_md_injection/scenario.py +128 -0
  72. gitinject/scenarios/malicious/dos_request_flood/scenario.py +80 -0
  73. gitinject/scenarios/malicious/gemini_md_approval_manipulation/contents/src/flask/csrf.py +151 -0
  74. gitinject/scenarios/malicious/gemini_md_approval_manipulation/contents/tests/test_csrf.py +71 -0
  75. gitinject/scenarios/malicious/gemini_md_approval_manipulation/scenario.py +121 -0
  76. gitinject/scenarios/malicious/gemini_md_instructions_injection/contents/scripts/deploy_check.sh +38 -0
  77. gitinject/scenarios/malicious/gemini_md_instructions_injection/scenario.py +105 -0
  78. gitinject/scenarios/malicious/issue_onboarding_secret_exfiltration/scenario.py +76 -0
  79. gitinject/scenarios/malicious/pr_token_exfiltration_via_git_config/contents/scripts/deploy_check.sh +7 -0
  80. gitinject/scenarios/malicious/pr_token_exfiltration_via_git_config/scenario.py +113 -0
  81. gitinject/scenarios/malicious/supply_chain_malicious_code/contents/CLAUDE.md +25 -0
  82. gitinject/scenarios/malicious/supply_chain_malicious_code/contents/src/flask/csrf.py +151 -0
  83. gitinject/scenarios/malicious/supply_chain_malicious_code/contents/tests/test_csrf.py +71 -0
  84. gitinject/scenarios/malicious/supply_chain_malicious_code/scenario.py +123 -0
  85. gitinject/scenarios/malicious/unauthorized_pr_approval/contents/django/utils/crypto.py +13 -0
  86. gitinject/scenarios/malicious/unauthorized_pr_approval/scenario.py +57 -0
  87. gitinject/simulator.py +89 -0
  88. gitinject/utils/__init__.py +0 -0
  89. gitinject/utils/gh_client.py +628 -0
  90. gitinject/utils/gl_client.py +132 -0
  91. gitinject/utils/gl_provisioner.py +83 -0
  92. gitinject/utils/llm.py +205 -0
  93. gitinject/utils/provisioner.py +114 -0
  94. gitinject/utils/scenario_resources.py +33 -0
  95. gitinject/utils/types.py +49 -0
  96. gitinject/workflows/__init__.py +0 -0
  97. gitinject/workflows/claude-ci-auto-fix/contents/.github/workflows/main.yml +107 -0
  98. gitinject/workflows/claude-ci-auto-fix/metadata.json +10 -0
  99. gitinject/workflows/claude-general/contents/.github/workflows/main.yml +58 -0
  100. gitinject/workflows/claude-general/metadata.json +10 -0
  101. gitinject/workflows/claude-gitlab-mr-review/contents/.gitlab-ci.yml +36 -0
  102. gitinject/workflows/claude-gitlab-mr-review/metadata.json +11 -0
  103. gitinject/workflows/claude-issue-deduplication/contents/.github/workflows/main.yml +66 -0
  104. gitinject/workflows/claude-issue-deduplication/metadata.json +10 -0
  105. gitinject/workflows/claude-issue-triage/contents/.github/workflows/main.yml +34 -0
  106. gitinject/workflows/claude-issue-triage/metadata.json +10 -0
  107. gitinject/workflows/claude-manual-analysis/contents/.github/workflows/main.yml +42 -0
  108. gitinject/workflows/claude-manual-analysis/metadata.json +10 -0
  109. gitinject/workflows/claude-pr-review/contents/.github/workflows/main.yml +77 -0
  110. gitinject/workflows/claude-pr-review/metadata.json +10 -0
  111. gitinject/workflows/claude-pr-review-authors/contents/.github/workflows/main.yml +48 -0
  112. gitinject/workflows/claude-pr-review-authors/metadata.json +10 -0
  113. gitinject/workflows/claude-pr-review-paths/contents/.github/workflows/main.yml +49 -0
  114. gitinject/workflows/claude-pr-review-paths/metadata.json +10 -0
  115. gitinject/workflows/claude-test-analysis/contents/.github/workflows/main.yml +114 -0
  116. gitinject/workflows/claude-test-analysis/metadata.json +10 -0
  117. gitinject/workflows/cline-assistant/contents/.github/workflows/main.yml +87 -0
  118. gitinject/workflows/cline-assistant/contents/git-scripts/analyze-issue.sh +43 -0
  119. gitinject/workflows/cline-assistant/metadata.json +10 -0
  120. gitinject/workflows/codex-pr-review/contents/.github/workflows/main.yml +73 -0
  121. gitinject/workflows/codex-pr-review/metadata.json +10 -0
  122. gitinject/workflows/copilot-ci-doctor/contents/.github/workflows/ci-doctor.yml +1161 -0
  123. gitinject/workflows/copilot-ci-doctor/metadata.json +10 -0
  124. gitinject/workflows/copilot-lean-squad/contents/.github/workflows/lean-squad.yml +1313 -0
  125. gitinject/workflows/copilot-lean-squad/metadata.json +10 -0
  126. gitinject/workflows/copilot-malicious-scan/contents/.github/workflows/daily-malicious-code-scan.yml +899 -0
  127. gitinject/workflows/copilot-malicious-scan/metadata.json +10 -0
  128. gitinject/workflows/copilot-repo-assist/contents/.github/workflows/repo-assist.yml +1503 -0
  129. gitinject/workflows/copilot-repo-assist/metadata.json +10 -0
  130. gitinject/workflows/copilot-wiki-writer/contents/.github/workflows/agentic-wiki-writer.yml +1316 -0
  131. gitinject/workflows/copilot-wiki-writer/metadata.json +10 -0
  132. gitinject/workflows/gemini-assistant/contents/.github/workflows/gemini-invoke.yml +122 -0
  133. gitinject/workflows/gemini-assistant/contents/.github/workflows/gemini-plan-execute.yml +130 -0
  134. gitinject/workflows/gemini-assistant/contents/.github/workflows/gemini-review.yml +118 -0
  135. gitinject/workflows/gemini-assistant/contents/.github/workflows/gemini-scheduled-triage.yml +220 -0
  136. gitinject/workflows/gemini-assistant/contents/.github/workflows/gemini-triage.yml +160 -0
  137. gitinject/workflows/gemini-assistant/contents/.github/workflows/main.yml +220 -0
  138. gitinject/workflows/gemini-assistant/metadata.json +10 -0
  139. gitinject/workflows/gemini-assistant-original/AWESOME.md +118 -0
  140. gitinject/workflows/gemini-assistant-original/CONFIGURATION.md +162 -0
  141. gitinject/workflows/gemini-assistant-original/README.md +93 -0
  142. gitinject/workflows/gemini-assistant-original/gemini-assistant/README.md +192 -0
  143. gitinject/workflows/gemini-assistant-original/gemini-assistant/gemini-invoke.toml +94 -0
  144. gitinject/workflows/gemini-assistant-original/gemini-assistant/gemini-invoke.yml +131 -0
  145. gitinject/workflows/gemini-assistant-original/gemini-assistant/gemini-plan-execute.toml +100 -0
  146. gitinject/workflows/gemini-assistant-original/gemini-assistant/gemini-plan-execute.yml +139 -0
  147. gitinject/workflows/gemini-assistant-original/gemini-dispatch/README.md +49 -0
  148. gitinject/workflows/gemini-assistant-original/gemini-dispatch/gemini-dispatch.yml +221 -0
  149. gitinject/workflows/gemini-assistant-original/issue-triage/README.md +190 -0
  150. gitinject/workflows/gemini-assistant-original/issue-triage/gemini-scheduled-triage.toml +96 -0
  151. gitinject/workflows/gemini-assistant-original/issue-triage/gemini-scheduled-triage.yml +223 -0
  152. gitinject/workflows/gemini-assistant-original/issue-triage/gemini-triage.toml +32 -0
  153. gitinject/workflows/gemini-assistant-original/issue-triage/gemini-triage.yml +167 -0
  154. gitinject/workflows/gemini-assistant-original/metadata.json +10 -0
  155. gitinject/workflows/gemini-assistant-original/pr-review/README.md +337 -0
  156. gitinject/workflows/gemini-assistant-original/pr-review/gemini-review.toml +176 -0
  157. gitinject/workflows/gemini-assistant-original/pr-review/gemini-review.yml +119 -0
  158. gitinject/workflows/opencode-pr-review/contents/.github/workflows/main.yml +28 -0
  159. gitinject/workflows/opencode-pr-review/metadata.json +10 -0
  160. gitinject-0.1.0.dist-info/METADATA +128 -0
  161. gitinject-0.1.0.dist-info/RECORD +164 -0
  162. gitinject-0.1.0.dist-info/WHEEL +4 -0
  163. gitinject-0.1.0.dist-info/entry_points.txt +2 -0
  164. gitinject-0.1.0.dist-info/licenses/LICENSE +202 -0
@@ -0,0 +1,1316 @@
1
+ # ___ _ _
2
+ # / _ \ | | (_)
3
+ # | |_| | __ _ ___ _ __ | |_ _ ___
4
+ # | _ |/ _` |/ _ \ '_ \| __| |/ __|
5
+ # | | | | (_| | __/ | | | |_| | (__
6
+ # \_| |_/\__, |\___|_| |_|\__|_|\___|
7
+ # __/ |
8
+ # _ _ |___/
9
+ # | | | | / _| |
10
+ # | | | | ___ _ __ _ __| |_| | _____ ____
11
+ # | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___|
12
+ # \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \
13
+ # \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/
14
+ #
15
+ # This file was automatically generated by gh-aw (v0.62.5). DO NOT EDIT.
16
+ #
17
+ # To update this file, edit the corresponding .md file and run:
18
+ # gh aw compile
19
+ # Not all edits will cause changes to this file.
20
+ #
21
+ # For more information: https://github.github.com/gh-aw/introduction/overview/
22
+ #
23
+ # Generates GitHub wiki pages from source code using a PAGES.md template. Runs once a day if any merges to the default branch have happened, or on manual dispatch.
24
+ #
25
+ # gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"f2f17ae16b96b939589d0f50ec15aaba27167a4a7148e9f62f88a46ec2170049","compiler_version":"v0.62.5","strict":true,"agent_id":"copilot"}
26
+
27
+ name: "Agentic Wiki Writer"
28
+ "on":
29
+ schedule:
30
+ - cron: "39 18 * * *"
31
+ # Friendly format: daily (scattered)
32
+ workflow_dispatch:
33
+ inputs:
34
+ regenerate-template:
35
+ default: false
36
+ description: Regenerate PAGES.md from scratch (full regen)
37
+ type: boolean
38
+
39
+ permissions: {}
40
+
41
+ concurrency:
42
+ group: "gh-aw-${{ github.workflow }}"
43
+
44
+ run-name: "Agentic Wiki Writer"
45
+
46
+ jobs:
47
+ activation:
48
+ runs-on: ubuntu-slim
49
+ permissions:
50
+ contents: read
51
+ outputs:
52
+ comment_id: ""
53
+ comment_repo: ""
54
+ lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }}
55
+ model: ${{ steps.generate_aw_info.outputs.model }}
56
+ secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }}
57
+ steps:
58
+ - name: Setup Scripts
59
+ uses: github/gh-aw-actions/setup@dc50be57c94373431b49d3d0927f318ac2bb5c4c # v0.62.5
60
+ with:
61
+ destination: ${{ runner.temp }}/gh-aw/actions
62
+ - name: Generate agentic run info
63
+ id: generate_aw_info
64
+ env:
65
+ GH_AW_INFO_ENGINE_ID: "copilot"
66
+ GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI"
67
+ GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || '' }}
68
+ GH_AW_INFO_VERSION: ""
69
+ GH_AW_INFO_AGENT_VERSION: "latest"
70
+ GH_AW_INFO_CLI_VERSION: "v0.62.5"
71
+ GH_AW_INFO_WORKFLOW_NAME: "Agentic Wiki Writer"
72
+ GH_AW_INFO_EXPERIMENTAL: "false"
73
+ GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true"
74
+ GH_AW_INFO_STAGED: "false"
75
+ GH_AW_INFO_ALLOWED_DOMAINS: '["defaults"]'
76
+ GH_AW_INFO_FIREWALL_ENABLED: "true"
77
+ GH_AW_INFO_AWF_VERSION: "v0.24.5"
78
+ GH_AW_INFO_AWMG_VERSION: ""
79
+ GH_AW_INFO_FIREWALL_TYPE: "squid"
80
+ GH_AW_COMPILED_STRICT: "true"
81
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
82
+ with:
83
+ script: |
84
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
85
+ setupGlobals(core, github, context, exec, io);
86
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_aw_info.cjs');
87
+ await main(core, context);
88
+ - name: Validate COPILOT_GITHUB_TOKEN secret
89
+ id: validate-secret
90
+ run: ${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default
91
+ env:
92
+ COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
93
+ - name: Checkout .github and .agents folders
94
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
95
+ with:
96
+ persist-credentials: false
97
+ sparse-checkout: |
98
+ .github
99
+ .agents
100
+ sparse-checkout-cone-mode: true
101
+ fetch-depth: 1
102
+ - name: Check workflow file timestamps
103
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
104
+ env:
105
+ GH_AW_WORKFLOW_FILE: "agentic-wiki-writer.lock.yml"
106
+ with:
107
+ script: |
108
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
109
+ setupGlobals(core, github, context, exec, io);
110
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/check_workflow_timestamp_api.cjs');
111
+ await main();
112
+ - name: Create prompt with built-in context
113
+ env:
114
+ GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
115
+ GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }}
116
+ GH_AW_GITHUB_ACTOR: ${{ github.actor }}
117
+ GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }}
118
+ GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }}
119
+ GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
120
+ GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
121
+ GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
122
+ GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
123
+ GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
124
+ GH_AW_WIKI_NOTE: ${{ '' }}
125
+ run: |
126
+ bash ${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh
127
+ {
128
+ cat << 'GH_AW_PROMPT_EOF'
129
+ <system>
130
+ GH_AW_PROMPT_EOF
131
+ cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md"
132
+ cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md"
133
+ cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md"
134
+ cat "${RUNNER_TEMP}/gh-aw/prompts/repo_memory_prompt.md"
135
+ cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md"
136
+ cat << 'GH_AW_PROMPT_EOF'
137
+ <safe-output-tools>
138
+ Tools: create_pull_request, missing_tool, missing_data, noop
139
+ GH_AW_PROMPT_EOF
140
+ cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_create_pull_request.md"
141
+ cat << 'GH_AW_PROMPT_EOF'
142
+ </safe-output-tools>
143
+ <github-context>
144
+ The following GitHub context information is available for this workflow:
145
+ {{#if __GH_AW_GITHUB_ACTOR__ }}
146
+ - **actor**: __GH_AW_GITHUB_ACTOR__
147
+ {{/if}}
148
+ {{#if __GH_AW_GITHUB_REPOSITORY__ }}
149
+ - **repository**: __GH_AW_GITHUB_REPOSITORY__
150
+ {{/if}}
151
+ {{#if __GH_AW_GITHUB_WORKSPACE__ }}
152
+ - **workspace**: __GH_AW_GITHUB_WORKSPACE__
153
+ {{/if}}
154
+ {{#if __GH_AW_GITHUB_EVENT_ISSUE_NUMBER__ }}
155
+ - **issue-number**: #__GH_AW_GITHUB_EVENT_ISSUE_NUMBER__
156
+ {{/if}}
157
+ {{#if __GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER__ }}
158
+ - **discussion-number**: #__GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER__
159
+ {{/if}}
160
+ {{#if __GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__ }}
161
+ - **pull-request-number**: #__GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER__
162
+ {{/if}}
163
+ {{#if __GH_AW_GITHUB_EVENT_COMMENT_ID__ }}
164
+ - **comment-id**: __GH_AW_GITHUB_EVENT_COMMENT_ID__
165
+ {{/if}}
166
+ {{#if __GH_AW_GITHUB_RUN_ID__ }}
167
+ - **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__
168
+ {{/if}}
169
+ </github-context>
170
+
171
+ GH_AW_PROMPT_EOF
172
+ cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md"
173
+ cat << 'GH_AW_PROMPT_EOF'
174
+ </system>
175
+ GH_AW_PROMPT_EOF
176
+ cat << 'GH_AW_PROMPT_EOF'
177
+ {{#runtime-import agentic-wiki-writer.md}}
178
+ GH_AW_PROMPT_EOF
179
+ } > "$GH_AW_PROMPT"
180
+ - name: Interpolate variables and render templates
181
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
182
+ env:
183
+ GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
184
+ with:
185
+ script: |
186
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
187
+ setupGlobals(core, github, context, exec, io);
188
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/interpolate_prompt.cjs');
189
+ await main();
190
+ - name: Substitute placeholders
191
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
192
+ env:
193
+ GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
194
+ GH_AW_GITHUB_ACTOR: ${{ github.actor }}
195
+ GH_AW_GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }}
196
+ GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }}
197
+ GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
198
+ GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
199
+ GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
200
+ GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
201
+ GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
202
+ GH_AW_MEMORY_BRANCH_NAME: 'memory/agentic-wiki'
203
+ GH_AW_MEMORY_CONSTRAINTS: "\n\n**Constraints:**\n- **Max File Size**: 1048576 bytes (1.00 MB) per file\n- **Max File Count**: 50 files per commit\n- **Max Patch Size**: 10240 bytes (10 KB) total per push (max: 100 KB)\n"
204
+ GH_AW_MEMORY_DESCRIPTION: ' Source file mappings, content hashes, and file summaries for incremental wiki regeneration'
205
+ GH_AW_MEMORY_DIR: '/tmp/gh-aw/repo-memory/default/'
206
+ GH_AW_MEMORY_TARGET_REPO: ' of the current repository'
207
+ GH_AW_WIKI_NOTE: ''
208
+ with:
209
+ script: |
210
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
211
+ setupGlobals(core, github, context, exec, io);
212
+
213
+ const substitutePlaceholders = require('${{ runner.temp }}/gh-aw/actions/substitute_placeholders.cjs');
214
+
215
+ // Call the substitution function
216
+ return await substitutePlaceholders({
217
+ file: process.env.GH_AW_PROMPT,
218
+ substitutions: {
219
+ GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR,
220
+ GH_AW_GITHUB_EVENT_COMMENT_ID: process.env.GH_AW_GITHUB_EVENT_COMMENT_ID,
221
+ GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: process.env.GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER,
222
+ GH_AW_GITHUB_EVENT_ISSUE_NUMBER: process.env.GH_AW_GITHUB_EVENT_ISSUE_NUMBER,
223
+ GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: process.env.GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER,
224
+ GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY,
225
+ GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID,
226
+ GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE,
227
+ GH_AW_MEMORY_BRANCH_NAME: process.env.GH_AW_MEMORY_BRANCH_NAME,
228
+ GH_AW_MEMORY_CONSTRAINTS: process.env.GH_AW_MEMORY_CONSTRAINTS,
229
+ GH_AW_MEMORY_DESCRIPTION: process.env.GH_AW_MEMORY_DESCRIPTION,
230
+ GH_AW_MEMORY_DIR: process.env.GH_AW_MEMORY_DIR,
231
+ GH_AW_MEMORY_TARGET_REPO: process.env.GH_AW_MEMORY_TARGET_REPO,
232
+ GH_AW_WIKI_NOTE: process.env.GH_AW_WIKI_NOTE
233
+ }
234
+ });
235
+ - name: Validate prompt placeholders
236
+ env:
237
+ GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
238
+ run: bash ${RUNNER_TEMP}/gh-aw/actions/validate_prompt_placeholders.sh
239
+ - name: Print prompt
240
+ env:
241
+ GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
242
+ run: bash ${RUNNER_TEMP}/gh-aw/actions/print_prompt_summary.sh
243
+ - name: Upload activation artifact
244
+ if: success()
245
+ uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
246
+ with:
247
+ name: activation
248
+ path: |
249
+ /tmp/gh-aw/aw_info.json
250
+ /tmp/gh-aw/aw-prompts/prompt.txt
251
+ retention-days: 1
252
+
253
+ agent:
254
+ needs: activation
255
+ runs-on: ubuntu-latest
256
+ permissions:
257
+ contents: read
258
+ issues: read
259
+ pull-requests: read
260
+ concurrency:
261
+ group: "gh-aw-copilot-${{ github.workflow }}"
262
+ env:
263
+ DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
264
+ GH_AW_ASSETS_ALLOWED_EXTS: ""
265
+ GH_AW_ASSETS_BRANCH: ""
266
+ GH_AW_ASSETS_MAX_SIZE_KB: 0
267
+ GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs
268
+ GH_AW_WORKFLOW_ID_SANITIZED: agenticwikiwriter
269
+ outputs:
270
+ checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }}
271
+ detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }}
272
+ detection_success: ${{ steps.detection_conclusion.outputs.success }}
273
+ has_patch: ${{ steps.collect_output.outputs.has_patch }}
274
+ inference_access_error: ${{ steps.detect-inference-error.outputs.inference_access_error || 'false' }}
275
+ model: ${{ needs.activation.outputs.model }}
276
+ output: ${{ steps.collect_output.outputs.output }}
277
+ output_types: ${{ steps.collect_output.outputs.output_types }}
278
+ steps:
279
+ - name: Setup Scripts
280
+ uses: github/gh-aw-actions/setup@dc50be57c94373431b49d3d0927f318ac2bb5c4c # v0.62.5
281
+ with:
282
+ destination: ${{ runner.temp }}/gh-aw/actions
283
+ - name: Set runtime paths
284
+ run: |
285
+ echo "GH_AW_SAFE_OUTPUTS=${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl" >> "$GITHUB_ENV"
286
+ echo "GH_AW_SAFE_OUTPUTS_CONFIG_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" >> "$GITHUB_ENV"
287
+ echo "GH_AW_SAFE_OUTPUTS_TOOLS_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/tools.json" >> "$GITHUB_ENV"
288
+ - name: Checkout repository
289
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
290
+ with:
291
+ persist-credentials: false
292
+ - name: Create gh-aw temp directory
293
+ run: bash ${RUNNER_TEMP}/gh-aw/actions/create_gh_aw_tmp_dir.sh
294
+ - name: Configure gh CLI for GitHub Enterprise
295
+ run: bash ${RUNNER_TEMP}/gh-aw/actions/configure_gh_for_ghe.sh
296
+ env:
297
+ GH_TOKEN: ${{ github.token }}
298
+ - name: Pre-stage event payload for sandbox
299
+ run: |
300
+ cp "$GITHUB_EVENT_PATH" /tmp/gh-aw/event.json
301
+ echo "Event payload staged to /tmp/gh-aw/event.json"
302
+ cat /tmp/gh-aw/event.json
303
+ - name: Create agentic-wiki directory
304
+ run: mkdir -p .github/agentic-wiki
305
+
306
+ # Repo memory git-based storage configuration from frontmatter processed below
307
+ - name: Clone repo-memory branch (default)
308
+ env:
309
+ GH_TOKEN: ${{ github.token }}
310
+ GITHUB_SERVER_URL: ${{ github.server_url }}
311
+ BRANCH_NAME: memory/agentic-wiki
312
+ TARGET_REPO: ${{ github.repository }}
313
+ MEMORY_DIR: /tmp/gh-aw/repo-memory/default
314
+ CREATE_ORPHAN: true
315
+ run: bash ${RUNNER_TEMP}/gh-aw/actions/clone_repo_memory_branch.sh
316
+ - name: Configure Git credentials
317
+ env:
318
+ REPO_NAME: ${{ github.repository }}
319
+ SERVER_URL: ${{ github.server_url }}
320
+ run: |
321
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
322
+ git config --global user.name "github-actions[bot]"
323
+ git config --global am.keepcr true
324
+ # Re-authenticate git with GitHub token
325
+ SERVER_URL_STRIPPED="${SERVER_URL#https://}"
326
+ git remote set-url origin "https://x-access-token:${{ github.token }}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
327
+ echo "Git configured with standard GitHub Actions identity"
328
+ - name: Checkout PR branch
329
+ id: checkout-pr
330
+ if: |
331
+ github.event.pull_request || github.event.issue.pull_request
332
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
333
+ env:
334
+ GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
335
+ with:
336
+ github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
337
+ script: |
338
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
339
+ setupGlobals(core, github, context, exec, io);
340
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/checkout_pr_branch.cjs');
341
+ await main();
342
+ - name: Install GitHub Copilot CLI
343
+ run: ${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh latest
344
+ env:
345
+ GH_HOST: github.com
346
+ - name: Install AWF binary
347
+ run: bash ${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh v0.24.5
348
+ - name: Determine automatic lockdown mode for GitHub MCP Server
349
+ id: determine-automatic-lockdown
350
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
351
+ env:
352
+ GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
353
+ GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
354
+ with:
355
+ script: |
356
+ const determineAutomaticLockdown = require('${{ runner.temp }}/gh-aw/actions/determine_automatic_lockdown.cjs');
357
+ await determineAutomaticLockdown(github, context, core);
358
+ - name: Download container images
359
+ run: bash ${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh ghcr.io/github/gh-aw-firewall/agent:0.24.5 ghcr.io/github/gh-aw-firewall/api-proxy:0.24.5 ghcr.io/github/gh-aw-firewall/squid:0.24.5 ghcr.io/github/gh-aw-mcpg:v0.1.20 ghcr.io/github/github-mcp-server:v0.32.0 node:lts-alpine
360
+ - name: Write Safe Outputs Config
361
+ run: |
362
+ mkdir -p ${RUNNER_TEMP}/gh-aw/safeoutputs
363
+ mkdir -p /tmp/gh-aw/safeoutputs
364
+ mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs
365
+ cat > ${RUNNER_TEMP}/gh-aw/safeoutputs/config.json << 'GH_AW_SAFE_OUTPUTS_CONFIG_EOF'
366
+ {"create_pull_request":{"max":1,"title_prefix":"[agentic-wiki]"},"missing_data":{},"missing_tool":{},"noop":{"max":1},"push-wiki":{"description":"Push generated wiki pages to the repository wiki. Pass a JSON object mapping filenames to markdown content.\n","inputs":{"files":{"default":null,"description":"JSON object mapping filenames to markdown content, e.g. {\"Home.md\": \"...\", \"_Sidebar.md\": \"...\"}","required":true,"type":"string"}},"output":"Wiki pages pushed successfully"},"push_repo_memory":{"memories":[{"dir":"/tmp/gh-aw/repo-memory/default","id":"default","max_file_count":50,"max_file_size":1048576,"max_patch_size":10240}]}}
367
+ GH_AW_SAFE_OUTPUTS_CONFIG_EOF
368
+ - name: Write Safe Outputs Tools
369
+ run: |
370
+ cat > ${RUNNER_TEMP}/gh-aw/safeoutputs/tools_meta.json << 'GH_AW_SAFE_OUTPUTS_TOOLS_META_EOF'
371
+ {
372
+ "description_suffixes": {
373
+ "create_pull_request": " CONSTRAINTS: Maximum 1 pull request(s) can be created. Title will be prefixed with \"[agentic-wiki]\". Labels [\"documentation\" \"automated\"] will be automatically added."
374
+ },
375
+ "repo_params": {},
376
+ "dynamic_tools": [
377
+ {
378
+ "description": "Push generated wiki pages to the repository wiki. Pass a JSON object mapping filenames to markdown content.\n",
379
+ "inputSchema": {
380
+ "additionalProperties": false,
381
+ "properties": {
382
+ "files": {
383
+ "description": "JSON object mapping filenames to markdown content, e.g. {\"Home.md\": \"...\", \"_Sidebar.md\": \"...\"}",
384
+ "type": "string"
385
+ }
386
+ },
387
+ "required": [
388
+ "files"
389
+ ],
390
+ "type": "object"
391
+ },
392
+ "name": "push_wiki"
393
+ }
394
+ ]
395
+ }
396
+ GH_AW_SAFE_OUTPUTS_TOOLS_META_EOF
397
+ cat > ${RUNNER_TEMP}/gh-aw/safeoutputs/validation.json << 'GH_AW_SAFE_OUTPUTS_VALIDATION_EOF'
398
+ {
399
+ "create_pull_request": {
400
+ "defaultMax": 1,
401
+ "fields": {
402
+ "body": {
403
+ "required": true,
404
+ "type": "string",
405
+ "sanitize": true,
406
+ "maxLength": 65000
407
+ },
408
+ "branch": {
409
+ "required": true,
410
+ "type": "string",
411
+ "sanitize": true,
412
+ "maxLength": 256
413
+ },
414
+ "draft": {
415
+ "type": "boolean"
416
+ },
417
+ "labels": {
418
+ "type": "array",
419
+ "itemType": "string",
420
+ "itemSanitize": true,
421
+ "itemMaxLength": 128
422
+ },
423
+ "repo": {
424
+ "type": "string",
425
+ "maxLength": 256
426
+ },
427
+ "title": {
428
+ "required": true,
429
+ "type": "string",
430
+ "sanitize": true,
431
+ "maxLength": 128
432
+ }
433
+ }
434
+ },
435
+ "missing_data": {
436
+ "defaultMax": 20,
437
+ "fields": {
438
+ "alternatives": {
439
+ "type": "string",
440
+ "sanitize": true,
441
+ "maxLength": 256
442
+ },
443
+ "context": {
444
+ "type": "string",
445
+ "sanitize": true,
446
+ "maxLength": 256
447
+ },
448
+ "data_type": {
449
+ "type": "string",
450
+ "sanitize": true,
451
+ "maxLength": 128
452
+ },
453
+ "reason": {
454
+ "type": "string",
455
+ "sanitize": true,
456
+ "maxLength": 256
457
+ }
458
+ }
459
+ },
460
+ "missing_tool": {
461
+ "defaultMax": 20,
462
+ "fields": {
463
+ "alternatives": {
464
+ "type": "string",
465
+ "sanitize": true,
466
+ "maxLength": 512
467
+ },
468
+ "reason": {
469
+ "required": true,
470
+ "type": "string",
471
+ "sanitize": true,
472
+ "maxLength": 256
473
+ },
474
+ "tool": {
475
+ "type": "string",
476
+ "sanitize": true,
477
+ "maxLength": 128
478
+ }
479
+ }
480
+ },
481
+ "noop": {
482
+ "defaultMax": 1,
483
+ "fields": {
484
+ "message": {
485
+ "required": true,
486
+ "type": "string",
487
+ "sanitize": true,
488
+ "maxLength": 65000
489
+ }
490
+ }
491
+ }
492
+ }
493
+ GH_AW_SAFE_OUTPUTS_VALIDATION_EOF
494
+ node ${RUNNER_TEMP}/gh-aw/actions/generate_safe_outputs_tools.cjs
495
+ - name: Generate Safe Outputs MCP Server Config
496
+ id: safe-outputs-config
497
+ run: |
498
+ # Generate a secure random API key (360 bits of entropy, 40+ chars)
499
+ # Mask immediately to prevent timing vulnerabilities
500
+ API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
501
+ echo "::add-mask::${API_KEY}"
502
+
503
+ PORT=3001
504
+
505
+ # Set outputs for next steps
506
+ {
507
+ echo "safe_outputs_api_key=${API_KEY}"
508
+ echo "safe_outputs_port=${PORT}"
509
+ } >> "$GITHUB_OUTPUT"
510
+
511
+ echo "Safe Outputs MCP server will run on port ${PORT}"
512
+
513
+ - name: Start Safe Outputs MCP HTTP Server
514
+ id: safe-outputs-start
515
+ env:
516
+ DEBUG: '*'
517
+ GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-config.outputs.safe_outputs_port }}
518
+ GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-config.outputs.safe_outputs_api_key }}
519
+ GH_AW_SAFE_OUTPUTS_TOOLS_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/tools.json
520
+ GH_AW_SAFE_OUTPUTS_CONFIG_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/config.json
521
+ GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs
522
+ run: |
523
+ # Environment variables are set above to prevent template injection
524
+ export DEBUG
525
+ export GH_AW_SAFE_OUTPUTS_PORT
526
+ export GH_AW_SAFE_OUTPUTS_API_KEY
527
+ export GH_AW_SAFE_OUTPUTS_TOOLS_PATH
528
+ export GH_AW_SAFE_OUTPUTS_CONFIG_PATH
529
+ export GH_AW_MCP_LOG_DIR
530
+
531
+ bash ${RUNNER_TEMP}/gh-aw/actions/start_safe_outputs_server.sh
532
+
533
+ - name: Start MCP Gateway
534
+ id: start-mcp-gateway
535
+ env:
536
+ GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }}
537
+ GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-start.outputs.api_key }}
538
+ GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-start.outputs.port }}
539
+ GITHUB_MCP_GUARD_MIN_INTEGRITY: ${{ steps.determine-automatic-lockdown.outputs.min_integrity }}
540
+ GITHUB_MCP_GUARD_REPOS: ${{ steps.determine-automatic-lockdown.outputs.repos }}
541
+ GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
542
+ run: |
543
+ set -eo pipefail
544
+ mkdir -p /tmp/gh-aw/mcp-config
545
+
546
+ # Export gateway environment variables for MCP config and gateway script
547
+ export MCP_GATEWAY_PORT="80"
548
+ export MCP_GATEWAY_DOMAIN="host.docker.internal"
549
+ MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
550
+ echo "::add-mask::${MCP_GATEWAY_API_KEY}"
551
+ export MCP_GATEWAY_API_KEY
552
+ export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads"
553
+ mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}"
554
+ export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288"
555
+ export DEBUG="*"
556
+
557
+ export GH_AW_ENGINE="copilot"
558
+ 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.1.20'
559
+
560
+ mkdir -p /home/runner/.copilot
561
+ cat << GH_AW_MCP_CONFIG_EOF | bash ${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.sh
562
+ {
563
+ "mcpServers": {
564
+ "github": {
565
+ "type": "stdio",
566
+ "container": "ghcr.io/github/github-mcp-server:v0.32.0",
567
+ "env": {
568
+ "GITHUB_HOST": "\${GITHUB_SERVER_URL}",
569
+ "GITHUB_PERSONAL_ACCESS_TOKEN": "\${GITHUB_MCP_SERVER_TOKEN}",
570
+ "GITHUB_READ_ONLY": "1",
571
+ "GITHUB_TOOLSETS": "context,repos,issues,pull_requests"
572
+ },
573
+ "guard-policies": {
574
+ "allow-only": {
575
+ "min-integrity": "$GITHUB_MCP_GUARD_MIN_INTEGRITY",
576
+ "repos": "$GITHUB_MCP_GUARD_REPOS"
577
+ }
578
+ }
579
+ },
580
+ "safeoutputs": {
581
+ "type": "http",
582
+ "url": "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT",
583
+ "headers": {
584
+ "Authorization": "\${GH_AW_SAFE_OUTPUTS_API_KEY}"
585
+ },
586
+ "guard-policies": {
587
+ "write-sink": {
588
+ "accept": [
589
+ "*"
590
+ ]
591
+ }
592
+ }
593
+ }
594
+ },
595
+ "gateway": {
596
+ "port": $MCP_GATEWAY_PORT,
597
+ "domain": "${MCP_GATEWAY_DOMAIN}",
598
+ "apiKey": "${MCP_GATEWAY_API_KEY}",
599
+ "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}"
600
+ }
601
+ }
602
+ GH_AW_MCP_CONFIG_EOF
603
+ - name: Download activation artifact
604
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
605
+ with:
606
+ name: activation
607
+ path: /tmp/gh-aw
608
+ - name: Clean git credentials
609
+ continue-on-error: true
610
+ run: bash ${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh
611
+ - name: Execute GitHub Copilot CLI
612
+ id: agentic_execution
613
+ # Copilot CLI tool arguments (sorted):
614
+ # --allow-tool github
615
+ # --allow-tool safeoutputs
616
+ # --allow-tool shell(cat *)
617
+ # --allow-tool shell(cat)
618
+ # --allow-tool shell(date)
619
+ # --allow-tool shell(echo)
620
+ # --allow-tool shell(find * -type f -not -path '*/node_modules/*' -not -path '*/.git/*')
621
+ # --allow-tool shell(git add:*)
622
+ # --allow-tool shell(git branch:*)
623
+ # --allow-tool shell(git checkout:*)
624
+ # --allow-tool shell(git commit:*)
625
+ # --allow-tool shell(git merge:*)
626
+ # --allow-tool shell(git rm:*)
627
+ # --allow-tool shell(git status)
628
+ # --allow-tool shell(git switch:*)
629
+ # --allow-tool shell(grep)
630
+ # --allow-tool shell(head *)
631
+ # --allow-tool shell(head)
632
+ # --allow-tool shell(ls)
633
+ # --allow-tool shell(pwd)
634
+ # --allow-tool shell(sort)
635
+ # --allow-tool shell(tail)
636
+ # --allow-tool shell(tree *)
637
+ # --allow-tool shell(uniq)
638
+ # --allow-tool shell(wc *)
639
+ # --allow-tool shell(wc)
640
+ # --allow-tool shell(yq)
641
+ # --allow-tool write
642
+ timeout-minutes: 30
643
+ run: |
644
+ set -o pipefail
645
+ touch /tmp/gh-aw/agent-step-summary.md
646
+ # shellcheck disable=SC1003
647
+ sudo -E awf --env-all --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" --allow-domains "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.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,github.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,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.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 --enable-host-access --image-tag 0.24.5 --skip-pull --enable-api-proxy \
648
+ -- /bin/bash -c '/usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --add-dir "${GITHUB_WORKSPACE}" --disable-builtin-mcps --allow-tool github --allow-tool safeoutputs --allow-tool '\''shell(cat *)'\'' --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(date)'\'' --allow-tool '\''shell(echo)'\'' --allow-tool '\''shell(find * -type f -not -path '\''\'\'''\''*/node_modules/*'\''\'\'''\'' -not -path '\''\'\'''\''*/.git/*'\''\'\'''\'')'\'' --allow-tool '\''shell(git add:*)'\'' --allow-tool '\''shell(git branch:*)'\'' --allow-tool '\''shell(git checkout:*)'\'' --allow-tool '\''shell(git commit:*)'\'' --allow-tool '\''shell(git merge:*)'\'' --allow-tool '\''shell(git rm:*)'\'' --allow-tool '\''shell(git status)'\'' --allow-tool '\''shell(git switch:*)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head *)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(pwd)'\'' --allow-tool '\''shell(sort)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(tree *)'\'' --allow-tool '\''shell(uniq)'\'' --allow-tool '\''shell(wc *)'\'' --allow-tool '\''shell(wc)'\'' --allow-tool '\''shell(yq)'\'' --allow-tool write --allow-all-paths --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log
649
+ env:
650
+ COPILOT_AGENT_RUNNER_TYPE: STANDALONE
651
+ COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
652
+ COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || '' }}
653
+ GH_AW_MCP_CONFIG: /home/runner/.copilot/mcp-config.json
654
+ GH_AW_PHASE: agent
655
+ GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
656
+ GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }}
657
+ GH_AW_VERSION: v0.62.5
658
+ GITHUB_API_URL: ${{ github.api_url }}
659
+ GITHUB_AW: true
660
+ GITHUB_HEAD_REF: ${{ github.head_ref }}
661
+ GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
662
+ GITHUB_REF_NAME: ${{ github.ref_name }}
663
+ GITHUB_SERVER_URL: ${{ github.server_url }}
664
+ GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
665
+ GITHUB_WORKSPACE: ${{ github.workspace }}
666
+ GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
667
+ GIT_AUTHOR_NAME: github-actions[bot]
668
+ GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
669
+ GIT_COMMITTER_NAME: github-actions[bot]
670
+ XDG_CONFIG_HOME: /home/runner
671
+ - name: Detect inference access error
672
+ id: detect-inference-error
673
+ if: always()
674
+ continue-on-error: true
675
+ run: bash ${RUNNER_TEMP}/gh-aw/actions/detect_inference_access_error.sh
676
+ - name: Configure Git credentials
677
+ env:
678
+ REPO_NAME: ${{ github.repository }}
679
+ SERVER_URL: ${{ github.server_url }}
680
+ run: |
681
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
682
+ git config --global user.name "github-actions[bot]"
683
+ git config --global am.keepcr true
684
+ # Re-authenticate git with GitHub token
685
+ SERVER_URL_STRIPPED="${SERVER_URL#https://}"
686
+ git remote set-url origin "https://x-access-token:${{ github.token }}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
687
+ echo "Git configured with standard GitHub Actions identity"
688
+ - name: Copy Copilot session state files to logs
689
+ if: always()
690
+ continue-on-error: true
691
+ run: |
692
+ # Copy Copilot session state files to logs folder for artifact collection
693
+ # This ensures they are in /tmp/gh-aw/ where secret redaction can scan them
694
+ SESSION_STATE_DIR="$HOME/.copilot/session-state"
695
+ LOGS_DIR="/tmp/gh-aw/sandbox/agent/logs"
696
+
697
+ if [ -d "$SESSION_STATE_DIR" ]; then
698
+ echo "Copying Copilot session state files from $SESSION_STATE_DIR to $LOGS_DIR"
699
+ mkdir -p "$LOGS_DIR"
700
+ cp -v "$SESSION_STATE_DIR"/*.jsonl "$LOGS_DIR/" 2>/dev/null || true
701
+ echo "Session state files copied successfully"
702
+ else
703
+ echo "No session-state directory found at $SESSION_STATE_DIR"
704
+ fi
705
+ - name: Stop MCP Gateway
706
+ if: always()
707
+ continue-on-error: true
708
+ env:
709
+ MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }}
710
+ MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }}
711
+ GATEWAY_PID: ${{ steps.start-mcp-gateway.outputs.gateway-pid }}
712
+ run: |
713
+ bash ${RUNNER_TEMP}/gh-aw/actions/stop_mcp_gateway.sh "$GATEWAY_PID"
714
+ - name: Redact secrets in logs
715
+ if: always()
716
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
717
+ with:
718
+ script: |
719
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
720
+ setupGlobals(core, github, context, exec, io);
721
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs');
722
+ await main();
723
+ env:
724
+ GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN'
725
+ SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
726
+ SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}
727
+ SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }}
728
+ SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
729
+ - name: Append agent step summary
730
+ if: always()
731
+ run: bash ${RUNNER_TEMP}/gh-aw/actions/append_agent_step_summary.sh
732
+ - name: Copy Safe Outputs
733
+ if: always()
734
+ run: |
735
+ mkdir -p /tmp/gh-aw
736
+ cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true
737
+ - name: Ingest agent output
738
+ id: collect_output
739
+ if: always()
740
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
741
+ env:
742
+ GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }}
743
+ GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.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,github.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,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com"
744
+ GITHUB_SERVER_URL: ${{ github.server_url }}
745
+ GITHUB_API_URL: ${{ github.api_url }}
746
+ with:
747
+ script: |
748
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
749
+ setupGlobals(core, github, context, exec, io);
750
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/collect_ndjson_output.cjs');
751
+ await main();
752
+ - name: Parse agent logs for step summary
753
+ if: always()
754
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
755
+ env:
756
+ GH_AW_AGENT_OUTPUT: /tmp/gh-aw/sandbox/agent/logs/
757
+ with:
758
+ script: |
759
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
760
+ setupGlobals(core, github, context, exec, io);
761
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_copilot_log.cjs');
762
+ await main();
763
+ - name: Parse MCP Gateway logs for step summary
764
+ if: always()
765
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
766
+ with:
767
+ script: |
768
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
769
+ setupGlobals(core, github, context, exec, io);
770
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_mcp_gateway_log.cjs');
771
+ await main();
772
+ - name: Print firewall logs
773
+ if: always()
774
+ continue-on-error: true
775
+ env:
776
+ AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs
777
+ run: |
778
+ # Fix permissions on firewall logs so they can be uploaded as artifacts
779
+ # AWF runs with sudo, creating files owned by root
780
+ sudo chmod -R a+r /tmp/gh-aw/sandbox/firewall/logs 2>/dev/null || true
781
+ # Only run awf logs summary if awf command exists (it may not be installed if workflow failed before install step)
782
+ if command -v awf &> /dev/null; then
783
+ awf logs summary | tee -a "$GITHUB_STEP_SUMMARY"
784
+ else
785
+ echo 'AWF binary not installed, skipping firewall log summary'
786
+ fi
787
+ # Upload repo memory as artifacts for push job
788
+ - name: Upload repo-memory artifact (default)
789
+ if: always()
790
+ uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
791
+ with:
792
+ name: repo-memory-default
793
+ path: /tmp/gh-aw/repo-memory/default
794
+ retention-days: 1
795
+ if-no-files-found: ignore
796
+ - name: Upload agent artifacts
797
+ if: always()
798
+ continue-on-error: true
799
+ uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
800
+ with:
801
+ name: agent
802
+ path: |
803
+ /tmp/gh-aw/aw-prompts/prompt.txt
804
+ /tmp/gh-aw/sandbox/agent/logs/
805
+ /tmp/gh-aw/redacted-urls.log
806
+ /tmp/gh-aw/mcp-logs/
807
+ /tmp/gh-aw/sandbox/firewall/logs/
808
+ /tmp/gh-aw/agent-stdio.log
809
+ /tmp/gh-aw/agent/
810
+ /tmp/gh-aw/safeoutputs.jsonl
811
+ /tmp/gh-aw/agent_output.json
812
+ /tmp/gh-aw/aw-*.patch
813
+ if-no-files-found: ignore
814
+ # --- Threat Detection (inline) ---
815
+ - name: Check if detection needed
816
+ id: detection_guard
817
+ if: always()
818
+ env:
819
+ OUTPUT_TYPES: ${{ steps.collect_output.outputs.output_types }}
820
+ HAS_PATCH: ${{ steps.collect_output.outputs.has_patch }}
821
+ run: |
822
+ if [[ -n "$OUTPUT_TYPES" || "$HAS_PATCH" == "true" ]]; then
823
+ echo "run_detection=true" >> "$GITHUB_OUTPUT"
824
+ echo "Detection will run: output_types=$OUTPUT_TYPES, has_patch=$HAS_PATCH"
825
+ else
826
+ echo "run_detection=false" >> "$GITHUB_OUTPUT"
827
+ echo "Detection skipped: no agent outputs or patches to analyze"
828
+ fi
829
+ - name: Clear MCP configuration for detection
830
+ if: always() && steps.detection_guard.outputs.run_detection == 'true'
831
+ run: |
832
+ rm -f /tmp/gh-aw/mcp-config/mcp-servers.json
833
+ rm -f /home/runner/.copilot/mcp-config.json
834
+ rm -f "$GITHUB_WORKSPACE/.gemini/settings.json"
835
+ - name: Prepare threat detection files
836
+ if: always() && steps.detection_guard.outputs.run_detection == 'true'
837
+ run: |
838
+ mkdir -p /tmp/gh-aw/threat-detection/aw-prompts
839
+ cp /tmp/gh-aw/aw-prompts/prompt.txt /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt 2>/dev/null || true
840
+ cp /tmp/gh-aw/agent_output.json /tmp/gh-aw/threat-detection/agent_output.json 2>/dev/null || true
841
+ for f in /tmp/gh-aw/aw-*.patch; do
842
+ [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true
843
+ done
844
+ echo "Prepared threat detection files:"
845
+ ls -la /tmp/gh-aw/threat-detection/ 2>/dev/null || true
846
+ - name: Setup threat detection
847
+ if: always() && steps.detection_guard.outputs.run_detection == 'true'
848
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
849
+ env:
850
+ WORKFLOW_NAME: "Agentic Wiki Writer"
851
+ WORKFLOW_DESCRIPTION: "Generates GitHub wiki pages from source code using a PAGES.md template. Runs once a day if any merges to the default branch have happened, or on manual dispatch."
852
+ HAS_PATCH: ${{ steps.collect_output.outputs.has_patch }}
853
+ with:
854
+ script: |
855
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
856
+ setupGlobals(core, github, context, exec, io);
857
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/setup_threat_detection.cjs');
858
+ await main();
859
+ - name: Ensure threat-detection directory and log
860
+ if: always() && steps.detection_guard.outputs.run_detection == 'true'
861
+ run: |
862
+ mkdir -p /tmp/gh-aw/threat-detection
863
+ touch /tmp/gh-aw/threat-detection/detection.log
864
+ - name: Execute GitHub Copilot CLI
865
+ if: always() && steps.detection_guard.outputs.run_detection == 'true'
866
+ id: detection_agentic_execution
867
+ # Copilot CLI tool arguments (sorted):
868
+ # --allow-tool shell(cat)
869
+ # --allow-tool shell(grep)
870
+ # --allow-tool shell(head)
871
+ # --allow-tool shell(jq)
872
+ # --allow-tool shell(ls)
873
+ # --allow-tool shell(tail)
874
+ # --allow-tool shell(wc)
875
+ timeout-minutes: 20
876
+ run: |
877
+ set -o pipefail
878
+ touch /tmp/gh-aw/agent-step-summary.md
879
+ # shellcheck disable=SC1003
880
+ sudo -E awf --env-all --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" --allow-domains "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,github.com,host.docker.internal,raw.githubusercontent.com,registry.npmjs.org,telemetry.enterprise.githubcopilot.com" --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --enable-host-access --image-tag 0.24.5 --skip-pull --enable-api-proxy \
881
+ -- /bin/bash -c '/usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --add-dir "${GITHUB_WORKSPACE}" --disable-builtin-mcps --allow-tool '\''shell(cat)'\'' --allow-tool '\''shell(grep)'\'' --allow-tool '\''shell(head)'\'' --allow-tool '\''shell(jq)'\'' --allow-tool '\''shell(ls)'\'' --allow-tool '\''shell(tail)'\'' --allow-tool '\''shell(wc)'\'' --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log
882
+ env:
883
+ COPILOT_AGENT_RUNNER_TYPE: STANDALONE
884
+ COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
885
+ COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || '' }}
886
+ GH_AW_PHASE: detection
887
+ GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
888
+ GH_AW_VERSION: v0.62.5
889
+ GITHUB_API_URL: ${{ github.api_url }}
890
+ GITHUB_AW: true
891
+ GITHUB_HEAD_REF: ${{ github.head_ref }}
892
+ GITHUB_REF_NAME: ${{ github.ref_name }}
893
+ GITHUB_SERVER_URL: ${{ github.server_url }}
894
+ GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md
895
+ GITHUB_WORKSPACE: ${{ github.workspace }}
896
+ GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
897
+ GIT_AUTHOR_NAME: github-actions[bot]
898
+ GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
899
+ GIT_COMMITTER_NAME: github-actions[bot]
900
+ XDG_CONFIG_HOME: /home/runner
901
+ - name: Parse threat detection results
902
+ id: parse_detection_results
903
+ if: always() && steps.detection_guard.outputs.run_detection == 'true'
904
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
905
+ with:
906
+ script: |
907
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
908
+ setupGlobals(core, github, context, exec, io);
909
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_threat_detection_results.cjs');
910
+ await main();
911
+ - name: Upload threat detection log
912
+ if: always() && steps.detection_guard.outputs.run_detection == 'true'
913
+ uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
914
+ with:
915
+ name: detection
916
+ path: /tmp/gh-aw/threat-detection/detection.log
917
+ if-no-files-found: ignore
918
+ - name: Set detection conclusion
919
+ id: detection_conclusion
920
+ if: always()
921
+ env:
922
+ RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
923
+ DETECTION_SUCCESS: ${{ steps.parse_detection_results.outputs.success }}
924
+ run: |
925
+ if [[ "$RUN_DETECTION" != "true" ]]; then
926
+ echo "conclusion=skipped" >> "$GITHUB_OUTPUT"
927
+ echo "success=true" >> "$GITHUB_OUTPUT"
928
+ echo "Detection was not needed, marking as skipped"
929
+ elif [[ "$DETECTION_SUCCESS" == "true" ]]; then
930
+ echo "conclusion=success" >> "$GITHUB_OUTPUT"
931
+ echo "success=true" >> "$GITHUB_OUTPUT"
932
+ echo "Detection passed successfully"
933
+ else
934
+ echo "conclusion=failure" >> "$GITHUB_OUTPUT"
935
+ echo "success=false" >> "$GITHUB_OUTPUT"
936
+ echo "Detection found issues"
937
+ fi
938
+
939
+ conclusion:
940
+ needs:
941
+ - activation
942
+ - agent
943
+ - push_repo_memory
944
+ - push_wiki
945
+ - safe_outputs
946
+ if: always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true')
947
+ runs-on: ubuntu-slim
948
+ permissions:
949
+ contents: write
950
+ issues: write
951
+ pull-requests: write
952
+ concurrency:
953
+ group: "gh-aw-conclusion-agentic-wiki-writer"
954
+ cancel-in-progress: false
955
+ outputs:
956
+ noop_message: ${{ steps.noop.outputs.noop_message }}
957
+ tools_reported: ${{ steps.missing_tool.outputs.tools_reported }}
958
+ total_count: ${{ steps.missing_tool.outputs.total_count }}
959
+ steps:
960
+ - name: Setup Scripts
961
+ uses: github/gh-aw-actions/setup@dc50be57c94373431b49d3d0927f318ac2bb5c4c # v0.62.5
962
+ with:
963
+ destination: ${{ runner.temp }}/gh-aw/actions
964
+ - name: Download agent output artifact
965
+ id: download-agent-output
966
+ continue-on-error: true
967
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
968
+ with:
969
+ name: agent
970
+ path: /tmp/gh-aw/
971
+ - name: Setup agent output environment variable
972
+ if: steps.download-agent-output.outcome == 'success'
973
+ run: |
974
+ mkdir -p /tmp/gh-aw/
975
+ find "/tmp/gh-aw/" -type f -print
976
+ echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_ENV"
977
+ - name: Process No-Op Messages
978
+ id: noop
979
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
980
+ env:
981
+ GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }}
982
+ GH_AW_NOOP_MAX: "1"
983
+ GH_AW_WORKFLOW_NAME: "Agentic Wiki Writer"
984
+ with:
985
+ github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
986
+ script: |
987
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
988
+ setupGlobals(core, github, context, exec, io);
989
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/noop.cjs');
990
+ await main();
991
+ - name: Record Missing Tool
992
+ id: missing_tool
993
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
994
+ env:
995
+ GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }}
996
+ GH_AW_WORKFLOW_NAME: "Agentic Wiki Writer"
997
+ with:
998
+ github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
999
+ script: |
1000
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
1001
+ setupGlobals(core, github, context, exec, io);
1002
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/missing_tool.cjs');
1003
+ await main();
1004
+ - name: Handle Agent Failure
1005
+ id: handle_agent_failure
1006
+ if: always()
1007
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
1008
+ env:
1009
+ GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }}
1010
+ GH_AW_WORKFLOW_NAME: "Agentic Wiki Writer"
1011
+ GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
1012
+ GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
1013
+ GH_AW_WORKFLOW_ID: "agentic-wiki-writer"
1014
+ GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }}
1015
+ GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }}
1016
+ GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }}
1017
+ GH_AW_CODE_PUSH_FAILURE_ERRORS: ${{ needs.safe_outputs.outputs.code_push_failure_errors }}
1018
+ GH_AW_CODE_PUSH_FAILURE_COUNT: ${{ needs.safe_outputs.outputs.code_push_failure_count }}
1019
+ GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }}
1020
+ GH_AW_PUSH_REPO_MEMORY_RESULT: ${{ needs.push_repo_memory.result }}
1021
+ GH_AW_REPO_MEMORY_VALIDATION_FAILED_default: ${{ needs.push_repo_memory.outputs.validation_failed_default }}
1022
+ GH_AW_REPO_MEMORY_VALIDATION_ERROR_default: ${{ needs.push_repo_memory.outputs.validation_error_default }}
1023
+ GH_AW_REPO_MEMORY_PATCH_SIZE_EXCEEDED_default: ${{ needs.push_repo_memory.outputs.patch_size_exceeded_default }}
1024
+ GH_AW_GROUP_REPORTS: "false"
1025
+ GH_AW_FAILURE_REPORT_AS_ISSUE: "true"
1026
+ GH_AW_TIMEOUT_MINUTES: "30"
1027
+ with:
1028
+ github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
1029
+ script: |
1030
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
1031
+ setupGlobals(core, github, context, exec, io);
1032
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_agent_failure.cjs');
1033
+ await main();
1034
+ - name: Handle No-Op Message
1035
+ id: handle_noop_message
1036
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
1037
+ env:
1038
+ GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }}
1039
+ GH_AW_WORKFLOW_NAME: "Agentic Wiki Writer"
1040
+ GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
1041
+ GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
1042
+ GH_AW_NOOP_MESSAGE: ${{ steps.noop.outputs.noop_message }}
1043
+ GH_AW_NOOP_REPORT_AS_ISSUE: "true"
1044
+ with:
1045
+ github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
1046
+ script: |
1047
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
1048
+ setupGlobals(core, github, context, exec, io);
1049
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_noop_message.cjs');
1050
+ await main();
1051
+ - name: Handle Create Pull Request Error
1052
+ id: handle_create_pr_error
1053
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
1054
+ env:
1055
+ GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }}
1056
+ GH_AW_WORKFLOW_NAME: "Agentic Wiki Writer"
1057
+ GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
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);
1063
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_create_pr_error.cjs');
1064
+ await main();
1065
+
1066
+ push_repo_memory:
1067
+ needs: agent
1068
+ if: always() && needs.agent.outputs.detection_success == 'true'
1069
+ runs-on: ubuntu-latest
1070
+ permissions:
1071
+ contents: write
1072
+ concurrency:
1073
+ group: "push-repo-memory-${{ github.repository }}"
1074
+ cancel-in-progress: false
1075
+ outputs:
1076
+ patch_size_exceeded_default: ${{ steps.push_repo_memory_default.outputs.patch_size_exceeded }}
1077
+ validation_error_default: ${{ steps.push_repo_memory_default.outputs.validation_error }}
1078
+ validation_failed_default: ${{ steps.push_repo_memory_default.outputs.validation_failed }}
1079
+ steps:
1080
+ - name: Setup Scripts
1081
+ uses: github/gh-aw-actions/setup@dc50be57c94373431b49d3d0927f318ac2bb5c4c # v0.62.5
1082
+ with:
1083
+ destination: ${{ runner.temp }}/gh-aw/actions
1084
+ - name: Checkout repository
1085
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1086
+ with:
1087
+ persist-credentials: false
1088
+ sparse-checkout: .
1089
+ - name: Configure Git credentials
1090
+ env:
1091
+ REPO_NAME: ${{ github.repository }}
1092
+ SERVER_URL: ${{ github.server_url }}
1093
+ run: |
1094
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
1095
+ git config --global user.name "github-actions[bot]"
1096
+ git config --global am.keepcr true
1097
+ # Re-authenticate git with GitHub token
1098
+ SERVER_URL_STRIPPED="${SERVER_URL#https://}"
1099
+ git remote set-url origin "https://x-access-token:${{ github.token }}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
1100
+ echo "Git configured with standard GitHub Actions identity"
1101
+ - name: Download repo-memory artifact (default)
1102
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
1103
+ continue-on-error: true
1104
+ with:
1105
+ name: repo-memory-default
1106
+ path: /tmp/gh-aw/repo-memory/default
1107
+ - name: Push repo-memory changes (default)
1108
+ id: push_repo_memory_default
1109
+ if: always()
1110
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
1111
+ env:
1112
+ GH_TOKEN: ${{ github.token }}
1113
+ GITHUB_RUN_ID: ${{ github.run_id }}
1114
+ GITHUB_SERVER_URL: ${{ github.server_url }}
1115
+ ARTIFACT_DIR: /tmp/gh-aw/repo-memory/default
1116
+ MEMORY_ID: default
1117
+ TARGET_REPO: ${{ github.repository }}
1118
+ BRANCH_NAME: memory/agentic-wiki
1119
+ MAX_FILE_SIZE: 1048576
1120
+ MAX_FILE_COUNT: 50
1121
+ MAX_PATCH_SIZE: 10240
1122
+ ALLOWED_EXTENSIONS: '[".json",".md"]'
1123
+ with:
1124
+ script: |
1125
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
1126
+ setupGlobals(core, github, context, exec, io);
1127
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/push_repo_memory.cjs');
1128
+ await main();
1129
+
1130
+ push_wiki:
1131
+ needs: agent
1132
+ if: (!cancelled()) && needs.agent.result != 'skipped' && contains(needs.agent.outputs.output_types, 'push_wiki')
1133
+ runs-on: ubuntu-latest
1134
+ permissions:
1135
+ contents: write
1136
+ steps:
1137
+ - name: Download agent output artifact
1138
+ continue-on-error: true
1139
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
1140
+ with:
1141
+ name: agent
1142
+ path: ${{ runner.temp }}/gh-aw/safe-jobs/
1143
+ - name: Setup Safe Job Environment Variables
1144
+ run: |
1145
+ find "${RUNNER_TEMP}/gh-aw/safe-jobs/" -type f -print
1146
+ echo "GH_AW_AGENT_OUTPUT=${RUNNER_TEMP}/gh-aw/safe-jobs/agent_output.json" >> "$GITHUB_ENV"
1147
+ - name: Checkout wiki
1148
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1149
+ with:
1150
+ repository: ${{ github.repository }}.wiki
1151
+ token: ${{ secrets.GITHUB_TOKEN }}
1152
+ - name: Write wiki pages
1153
+ run: |
1154
+ jq -r '.items[] | select(.type == "push_wiki") | .files | fromjson | to_entries[] | @base64' "$GH_AW_AGENT_OUTPUT" | while IFS= read -r entry; do
1155
+ FILENAME=$(printf '%s' "$entry" | base64 -d | jq -r '.key')
1156
+ CONTENT=$(printf '%s' "$entry" | base64 -d | jq -r '.value')
1157
+ printf '%s\n' "$CONTENT" > "$FILENAME"
1158
+ done
1159
+ - name: Sanitize Mermaid diagrams
1160
+ run: |
1161
+ python3 - <<'EOF'
1162
+ import re, glob
1163
+
1164
+ def fix_mermaid_block(block):
1165
+ # Remove backtick markdown-string syntax from node labels.
1166
+ # GitHub's wiki renderer does not support mermaid markdown strings
1167
+ # (e.g. A["`text`"]), causing "Unable to render rich display" errors.
1168
+ # Pattern: "` inside_bt ` after_bt " -> " inside_bt after_bt "
1169
+ def fix_backtick_label(m):
1170
+ inside_bt = m.group(1)
1171
+ after_bt = m.group(2)
1172
+ combined = re.sub(
1173
+ r'\s+', ' ',
1174
+ (inside_bt + ' ' + after_bt).replace('\\n', ' ')
1175
+ ).strip()
1176
+ return '"' + combined + '"'
1177
+
1178
+ fixed = re.sub(r'"`([^`]*)`([^"]*)"', fix_backtick_label, block)
1179
+ # Fix any remaining \n escape sequences in labels (replace with space)
1180
+ fixed = re.sub(r'\\n', ' ', fixed)
1181
+ return fixed
1182
+
1183
+ def fix_file(path):
1184
+ with open(path, encoding='utf-8') as f:
1185
+ content = f.read()
1186
+ parts = re.split(r'(```mermaid[^\n]*\n.*?```)', content, flags=re.DOTALL)
1187
+ fixed = ''.join(
1188
+ fix_mermaid_block(p) if p.startswith('```mermaid') else p
1189
+ for p in parts
1190
+ )
1191
+ if fixed != content:
1192
+ with open(path, 'w', encoding='utf-8') as f:
1193
+ f.write(fixed)
1194
+ return True
1195
+ return False
1196
+
1197
+ changed = [f for f in glob.glob('*.md') if fix_file(f)]
1198
+ if changed:
1199
+ print(f'Fixed Mermaid syntax in: {", ".join(changed)}')
1200
+ else:
1201
+ print('No Mermaid syntax issues found')
1202
+ EOF
1203
+ - name: Commit and push
1204
+ run: |
1205
+ git config user.name "github-actions[bot]"
1206
+ git config user.email "github-actions[bot]@users.noreply.github.com"
1207
+ git add -A
1208
+ git diff --cached --quiet && echo "No changes to commit" && exit 0
1209
+ git commit -m "Update wiki pages [agentic-wiki]"
1210
+ git push
1211
+
1212
+ safe_outputs:
1213
+ needs:
1214
+ - activation
1215
+ - agent
1216
+ if: (!cancelled()) && needs.agent.result != 'skipped' && needs.agent.outputs.detection_success == 'true'
1217
+ runs-on: ubuntu-slim
1218
+ permissions:
1219
+ contents: write
1220
+ issues: write
1221
+ pull-requests: write
1222
+ timeout-minutes: 15
1223
+ env:
1224
+ GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/agentic-wiki-writer"
1225
+ GH_AW_ENGINE_ID: "copilot"
1226
+ GH_AW_WORKFLOW_ID: "agentic-wiki-writer"
1227
+ GH_AW_WORKFLOW_NAME: "Agentic Wiki Writer"
1228
+ outputs:
1229
+ code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }}
1230
+ code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }}
1231
+ create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }}
1232
+ create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }}
1233
+ created_pr_number: ${{ steps.process_safe_outputs.outputs.created_pr_number }}
1234
+ created_pr_url: ${{ steps.process_safe_outputs.outputs.created_pr_url }}
1235
+ process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }}
1236
+ process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }}
1237
+ steps:
1238
+ - name: Setup Scripts
1239
+ uses: github/gh-aw-actions/setup@dc50be57c94373431b49d3d0927f318ac2bb5c4c # v0.62.5
1240
+ with:
1241
+ destination: ${{ runner.temp }}/gh-aw/actions
1242
+ - name: Download agent output artifact
1243
+ id: download-agent-output
1244
+ continue-on-error: true
1245
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
1246
+ with:
1247
+ name: agent
1248
+ path: /tmp/gh-aw/
1249
+ - name: Setup agent output environment variable
1250
+ if: steps.download-agent-output.outcome == 'success'
1251
+ run: |
1252
+ mkdir -p /tmp/gh-aw/
1253
+ find "/tmp/gh-aw/" -type f -print
1254
+ echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_ENV"
1255
+ - name: Download patch artifact
1256
+ continue-on-error: true
1257
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
1258
+ with:
1259
+ name: agent
1260
+ path: /tmp/gh-aw/
1261
+ - name: Checkout repository
1262
+ if: (!cancelled()) && needs.agent.result != 'skipped' && contains(needs.agent.outputs.output_types, 'create_pull_request')
1263
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1264
+ with:
1265
+ ref: ${{ github.base_ref || github.event.pull_request.base.ref || github.ref_name || github.event.repository.default_branch }}
1266
+ token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
1267
+ persist-credentials: false
1268
+ fetch-depth: 1
1269
+ - name: Configure Git credentials
1270
+ if: (!cancelled()) && needs.agent.result != 'skipped' && contains(needs.agent.outputs.output_types, 'create_pull_request')
1271
+ env:
1272
+ REPO_NAME: ${{ github.repository }}
1273
+ SERVER_URL: ${{ github.server_url }}
1274
+ GIT_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
1275
+ run: |
1276
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
1277
+ git config --global user.name "github-actions[bot]"
1278
+ git config --global am.keepcr true
1279
+ # Re-authenticate git with GitHub token
1280
+ SERVER_URL_STRIPPED="${SERVER_URL#https://}"
1281
+ git remote set-url origin "https://x-access-token:${GIT_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
1282
+ echo "Git configured with standard GitHub Actions identity"
1283
+ - name: Configure GH_HOST for enterprise compatibility
1284
+ shell: bash
1285
+ run: |
1286
+ # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct
1287
+ # GitHub instance (GHES/GHEC). On github.com this is a harmless no-op.
1288
+ GH_HOST="${GITHUB_SERVER_URL#https://}"
1289
+ GH_HOST="${GH_HOST#http://}"
1290
+ echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV"
1291
+ - name: Process Safe Outputs
1292
+ id: process_safe_outputs
1293
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
1294
+ env:
1295
+ GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }}
1296
+ GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.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,github.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,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com"
1297
+ GITHUB_SERVER_URL: ${{ github.server_url }}
1298
+ GITHUB_API_URL: ${{ github.api_url }}
1299
+ GH_AW_SAFE_OUTPUT_JOBS: "{\"push_wiki\":\"\"}"
1300
+ GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"create_pull_request\":{\"labels\":[\"documentation\",\"automated\"],\"max\":1,\"max_patch_size\":1024,\"protected_files\":[\"package.json\",\"bun.lockb\",\"bunfig.toml\",\"deno.json\",\"deno.jsonc\",\"deno.lock\",\"global.json\",\"NuGet.Config\",\"Directory.Packages.props\",\"mix.exs\",\"mix.lock\",\"go.mod\",\"go.sum\",\"stack.yaml\",\"stack.yaml.lock\",\"pom.xml\",\"build.gradle\",\"build.gradle.kts\",\"settings.gradle\",\"settings.gradle.kts\",\"gradle.properties\",\"package-lock.json\",\"yarn.lock\",\"pnpm-lock.yaml\",\"npm-shrinkwrap.json\",\"requirements.txt\",\"Pipfile\",\"Pipfile.lock\",\"pyproject.toml\",\"setup.py\",\"setup.cfg\",\"Gemfile\",\"Gemfile.lock\",\"uv.lock\",\"AGENTS.md\"],\"protected_files_policy\":\"fallback-to-issue\",\"protected_path_prefixes\":[\".github/\",\".agents/\"],\"title_prefix\":\"[agentic-wiki]\"},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"true\"}}"
1301
+ GH_AW_CI_TRIGGER_TOKEN: ${{ secrets.GH_AW_CI_TRIGGER_TOKEN }}
1302
+ with:
1303
+ github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
1304
+ script: |
1305
+ const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
1306
+ setupGlobals(core, github, context, exec, io);
1307
+ const { main } = require('${{ runner.temp }}/gh-aw/actions/safe_output_handler_manager.cjs');
1308
+ await main();
1309
+ - name: Upload safe output items
1310
+ if: always()
1311
+ uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
1312
+ with:
1313
+ name: safe-output-items
1314
+ path: /tmp/gh-aw/safe-output-items.jsonl
1315
+ if-no-files-found: ignore
1316
+