You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add pre-steps and post-steps support to threat detection job
- Add `PostSteps` field to `ThreatDetectionConfig` for post-execution steps
- Change `Steps` field semantics: now runs BEFORE engine execution (pre-steps)
- Update `HasRunnableDetection` to check both `Steps` and `PostSteps`
- Update `parseThreatDetectionConfig` to parse `post-steps` frontmatter field
- Update `buildDetectionJobSteps` to place Steps before and PostSteps after engine execution
- Update JSON schema to add `post-steps` field and update `steps` description
- Update documentation in threat-detection.md and frontmatter-full.md
- Update existing test and add new tests for pre/post step ordering
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/afee0692-364c-4f5e-b0d1-7add5d35cdca
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| `engine` | string/object/false | AI engine config (`"copilot"`, full config object, or `false` for no AI) |
92
95
| `runs-on` | string/array/object | Runner for the detection job (default: inherits from workflow `runs-on`) |
93
-
| `steps` | array | Additional GitHub Actions steps to run after AI analysis |
96
+
| `steps` | array | Additional GitHub Actions steps to run **before** AI analysis (pre-steps) |
97
+
| `post-steps` | array | Additional GitHub Actions steps to run **after** AI analysis (post-steps) |
94
98
95
99
## AI-Based Detection (Default)
96
100
@@ -186,13 +190,32 @@ safe-outputs:
186
190
187
191
## Custom Detection Steps
188
192
189
-
Add specialized security scanning tools alongside or instead of AI detection:
193
+
Add specialized security scanning tools alongside or instead of AI detection. You can run steps **before** the AI engine (for setup, gateway connections, etc.) and steps **after** (for additional scanning based on AI results).
194
+
195
+
### Pre-Steps (`steps:`)
196
+
197
+
Steps defined under `steps:` run **before** the AI engine executes. Use these for setup tasks such as connecting to a private AI gateway, installing security tools, or preparing artifacts.
190
198
191
199
```yaml wrap
192
200
safe-outputs:
193
201
create-pull-request:
194
202
threat-detection:
195
203
steps:
204
+
- name: Connect to Security Gateway
205
+
run: |
206
+
echo "Setting up secure connection to analysis gateway..."
207
+
# Authentication and connection setup
208
+
```
209
+
210
+
### Post-Steps (`post-steps:`)
211
+
212
+
Steps defined under `post-steps:` run **after** the AI engine completes its analysis. Use these for additional security scanning, reporting, or cleanup.
213
+
214
+
```yaml wrap
215
+
safe-outputs:
216
+
create-pull-request:
217
+
threat-detection:
218
+
post-steps:
196
219
- name: Run Security Scanner
197
220
run: |
198
221
echo "Scanning agent output for threats..."
@@ -206,11 +229,11 @@ safe-outputs:
206
229
207
230
**Available Artifacts:** Custom steps have access to `/tmp/gh-aw/threat-detection/prompt.txt` (workflow prompt), `agent_output.json` (safe output items), and `aw.patch` (git patch file).
208
231
209
-
**Execution Order:** Download artifacts → Run AI analysis (if enabled) → Execute custom steps → Upload detection log.
0 commit comments