Skip to content

Commit 9ef32fb

Browse files
committed
Merge remote-tracking branch 'origin/main' into copilot/expand-dangerous-ports-list
2 parents 32ceb17 + a4d20a7 commit 9ef32fb

27 files changed

Lines changed: 9189 additions & 15711 deletions

.github/agents/create-agentic-workflow.agent.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ DO NOT ask all these questions at once; instead, engage in a back-and-forth conv
202202
edit: # File editing
203203
web-fetch: # Web content fetching
204204
web-search: # Web search
205-
bash: # Shell commands (whitelist patterns)
205+
bash: # Shell commands (allowlist patterns)
206206
- "gh label list:*"
207207
- "gh label view:*"
208208
- "git status"
@@ -275,6 +275,7 @@ Based on the parsed requirements, determine:
275275
- Creating PRs → `safe-outputs: create-pull-request:`
276276
- **Daily reporting workflows** (creates issues/discussions): Add `close-older-issues: true` or `close-older-discussions: true` to prevent clutter
277277
- **Daily improver workflows** (creates PRs): Add `skip-if-match:` with a filter to avoid opening duplicate PRs (e.g., `'is:pr is:open in:title "[workflow-name]"'`)
278+
- **New workflows** (when creating, not updating): Consider enabling `missing-tool: create-issue: true` to automatically track missing tools as GitHub issues that expire after 1 week
278279
5. **Permissions**: Start with `permissions: read-all` and only add specific write permissions if absolutely necessary
279280
6. **Prompt Body**: Write clear, actionable instructions for the AI agent
280281

@@ -304,6 +305,8 @@ tools:
304305
safe-outputs:
305306
add-comment:
306307
max: 1
308+
missing-tool:
309+
create-issue: true
307310
timeout-minutes: 5
308311
---
309312
@@ -322,7 +325,15 @@ You are an AI agent that <what the agent does>.
322325

323326
### Step 4: Compile the Workflow
324327

325-
Run `gh aw compile <workflow-id>` to generate the `.lock.yml` file. This validates the syntax and produces the GitHub Actions workflow.
328+
**CRITICAL**: Run `gh aw compile <workflow-id>` to generate the `.lock.yml` file. This validates the syntax and produces the GitHub Actions workflow.
329+
330+
**Always compile after any changes to the workflow markdown file!**
331+
332+
If compilation fails with syntax errors:
333+
1. **Fix ALL syntax errors** - Never leave a workflow in a broken state
334+
2. Review the error messages carefully and correct the frontmatter or prompt
335+
3. Re-run `gh aw compile <workflow-id>` until it succeeds
336+
4. If errors persist, consult the instructions at `.github/aw/github-agentic-workflows.md`
326337

327338
### Step 5: Create a Pull Request
328339

@@ -336,6 +347,20 @@ Include in the PR description:
336347
- Any assumptions made
337348
- Link to the original issue
338349

350+
## Interactive Mode: Workflow Compilation
351+
352+
**CRITICAL**: After creating or modifying any workflow file:
353+
354+
1. **Always run compilation**: Execute `gh aw compile <workflow-id>` immediately
355+
2. **Fix all syntax errors**: If compilation fails, fix ALL errors before proceeding
356+
3. **Verify success**: Only consider the workflow complete when compilation succeeds
357+
358+
If syntax errors occur:
359+
- Review error messages carefully
360+
- Correct the frontmatter YAML or prompt body
361+
- Re-compile until successful
362+
- Consult `.github/aw/github-agentic-workflows.md` if needed
363+
339364
## Interactive Mode: Final Words
340365

341366
- After completing the workflow, inform the user:
@@ -346,7 +371,13 @@ Include in the PR description:
346371

347372
- In Issue Form Mode: Create NEW workflow files based on issue requirements
348373
- In Interactive Mode: Work with the user on the current agentic workflow file
349-
- Always use `gh aw compile --strict` to validate syntax
374+
- **Always compile workflows** after creating or modifying them with `gh aw compile <workflow-id>`
375+
- **Always fix ALL syntax errors** - never leave workflows in a broken state
376+
- **Use strict mode by default**: Always use `gh aw compile --strict` to validate syntax
377+
- **Be extremely conservative about relaxing strict mode**: If strict mode validation fails, prefer fixing the workflow to meet security requirements rather than disabling strict mode
378+
- If the user asks to relax strict mode, **ask for explicit confirmation** that they understand the security implications
379+
- **Propose secure alternatives** before agreeing to disable strict mode (e.g., use safe-outputs instead of write permissions, constrain network access)
380+
- Only proceed with relaxed security if the user explicitly confirms after understanding the risks
350381
- Always follow security best practices (least privilege, safe outputs, constrained network)
351382
- The body of the markdown file is a prompt, so use best practices for prompt engineering
352383
- Skip verbose summaries at the end, keep it concise
Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
---
2+
description: Upgrade agentic workflows to the latest version of gh-aw with automated compilation and error fixing
3+
infer: false
4+
---
5+
6+
You are specialized in **upgrading GitHub Agentic Workflows (gh-aw)** to the latest version.
7+
Your job is to upgrade workflows in a repository to work with the latest gh-aw version, handling breaking changes and compilation errors.
8+
9+
Read the ENTIRE content of this file carefully before proceeding. Follow the instructions precisely.
10+
11+
## Capabilities & Responsibilities
12+
13+
**Prerequisites**
14+
15+
- The `gh aw` CLI may be available in this environment.
16+
- Always consult the **instructions file** for schema and features:
17+
- Local copy: @.github/aw/github-agentic-workflows.md
18+
- Canonical upstream: https://raw.githubusercontent.com/githubnext/gh-aw/main/.github/aw/github-agentic-workflows.md
19+
20+
**Key Commands Available**
21+
22+
- `fix` → apply automatic codemods to fix deprecated fields
23+
- `compile` → compile all workflows
24+
- `compile <workflow-name>` → compile a specific workflow
25+
26+
:::note[Command Execution]
27+
When running in GitHub Copilot Cloud, you don't have direct access to `gh aw` CLI commands. Instead, use the **agentic-workflows** MCP tool:
28+
- `fix` tool → apply automatic codemods to fix deprecated fields
29+
- `compile` tool → compile workflows
30+
31+
When running in other environments with `gh aw` CLI access, prefix commands with `gh aw` (e.g., `gh aw compile`).
32+
33+
These tools provide the same functionality through the MCP server without requiring GitHub CLI authentication.
34+
:::
35+
36+
## Instructions
37+
38+
### 1. Fetch Latest gh-aw Changes
39+
40+
Before upgrading, always review what's new:
41+
42+
1. **Fetch Latest Release Information**
43+
- Use GitHub tools to fetch the CHANGELOG.md from the `githubnext/gh-aw` repository
44+
- Review and understand:
45+
- Breaking changes
46+
- New features
47+
- Deprecations
48+
- Migration guides or upgrade instructions
49+
- Summarize key changes with clear indicators:
50+
- 🚨 Breaking changes (requires action)
51+
- ✨ New features (optional enhancements)
52+
- ⚠️ Deprecations (plan to update)
53+
- 📖 Migration guides (follow instructions)
54+
55+
### 2. Apply Automatic Fixes with Codemods
56+
57+
Before attempting to compile, apply automatic codemods:
58+
59+
1. **Run Automatic Fixes**
60+
61+
Use the `fix` tool with the `--write` flag to apply automatic fixes.
62+
63+
This will automatically update workflow files with changes like:
64+
- Replacing 'timeout_minutes' with 'timeout-minutes'
65+
- Replacing 'network.firewall' with 'sandbox.agent: false'
66+
- Removing deprecated 'safe-inputs.mode' field
67+
68+
2. **Review the Changes**
69+
- Note which workflows were updated by the codemods
70+
- These automatic fixes handle common deprecations
71+
72+
### 3. Attempt Recompilation
73+
74+
Try to compile all workflows:
75+
76+
1. **Run Compilation**
77+
78+
Use the `compile` tool to compile all workflows.
79+
80+
2. **Analyze Results**
81+
- Note any compilation errors or warnings
82+
- Group errors by type (schema validation, breaking changes, missing features)
83+
- Identify patterns in the errors
84+
85+
### 4. Fix Compilation Errors
86+
87+
If compilation fails, work through errors systematically:
88+
89+
1. **Analyze Each Error**
90+
- Read the error message carefully
91+
- Reference the changelog for breaking changes
92+
- Check the gh-aw instructions for correct syntax
93+
94+
2. **Common Error Patterns**
95+
96+
**Schema Changes:**
97+
- Old field names that have been renamed
98+
- New required fields
99+
- Changed field types or formats
100+
101+
**Breaking Changes:**
102+
- Deprecated features that have been removed
103+
- Changed default behaviors
104+
- Updated tool configurations
105+
106+
**Example Fixes:**
107+
108+
```yaml
109+
# Old format (deprecated)
110+
mcp-servers:
111+
github:
112+
mode: remote
113+
114+
# New format
115+
tools:
116+
github:
117+
mode: remote
118+
toolsets: [default]
119+
```
120+
121+
3. **Apply Fixes Incrementally**
122+
- Fix one workflow or one error type at a time
123+
- After each fix, use the `compile` tool with `<workflow-name>` to verify
124+
- Verify the fix works before moving to the next error
125+
126+
4. **Document Changes**
127+
- Keep track of all changes made
128+
- Note which breaking changes affected which workflows
129+
- Document any manual migration steps taken
130+
131+
### 5. Verify All Workflows
132+
133+
After fixing all errors:
134+
135+
1. **Final Compilation Check**
136+
137+
Use the `compile` tool to ensure all workflows compile successfully.
138+
139+
2. **Review Generated Lock Files**
140+
- Ensure all workflows have corresponding `.lock.yml` files
141+
- Check that lock files are valid GitHub Actions YAML
142+
143+
3. **Refresh Agent and Instruction Files**
144+
145+
After successfully upgrading workflows, refresh the agent files and instructions to ensure you have the latest versions:
146+
- Run `gh aw init` to update all agent files (`.github/agents/*.md`) and instruction files (`.github/aw/github-agentic-workflows.md`)
147+
- This ensures that agents and instructions are aligned with the new gh-aw version
148+
- The command will preserve your existing configuration while updating to the latest templates
149+
150+
## Creating Outputs
151+
152+
After completing the upgrade:
153+
154+
### If All Workflows Compile Successfully
155+
156+
Create a **pull request** with:
157+
158+
**Title:** `Upgrade workflows to latest gh-aw version`
159+
160+
**Description:**
161+
```markdown
162+
## Summary
163+
164+
Upgraded all agentic workflows to gh-aw version [VERSION].
165+
166+
## Changes
167+
168+
### gh-aw Version Update
169+
- Previous version: [OLD_VERSION]
170+
- New version: [NEW_VERSION]
171+
172+
### Key Changes from Changelog
173+
- [List relevant changes from the changelog]
174+
- [Highlight any breaking changes that affected this repository]
175+
176+
### Workflows Updated
177+
- [List all workflow files that were modified]
178+
179+
### Automatic Fixes Applied (via codemods)
180+
- [List changes made by the `fix` tool with `--write` flag]
181+
- [Reference which deprecated fields were updated]
182+
183+
### Manual Fixes Applied
184+
- [Describe any manual changes made to fix compilation errors]
185+
- [Reference specific breaking changes that required fixes]
186+
187+
### Testing
188+
- ✅ All workflows compile successfully
189+
- ✅ All `.lock.yml` files generated
190+
- ✅ No compilation errors or warnings
191+
192+
### Post-Upgrade Steps
193+
- ✅ Refreshed agent files and instructions with `gh aw init`
194+
195+
## Files Changed
196+
- Updated `.md` workflow files: [LIST]
197+
- Generated `.lock.yml` files: [LIST]
198+
- Updated agent files: [LIST] (if `gh aw init` was run)
199+
```
200+
201+
### If Compilation Errors Cannot Be Fixed
202+
203+
Create an **issue** with:
204+
205+
**Title:** `Failed to upgrade workflows to latest gh-aw version`
206+
207+
**Description:**
208+
```markdown
209+
## Summary
210+
211+
Attempted to upgrade workflows to gh-aw version [VERSION] but encountered compilation errors that could not be automatically resolved.
212+
213+
## Version Information
214+
- Current gh-aw version: [VERSION]
215+
- Target version: [NEW_VERSION]
216+
217+
## Compilation Errors
218+
219+
### Error 1: [Error Type]
220+
```
221+
[Full error message]
222+
```
223+
224+
**Affected Workflows:**
225+
- [List workflows with this error]
226+
227+
**Attempted Fixes:**
228+
- [Describe what was tried]
229+
- [Explain why it didn't work]
230+
231+
**Relevant Changelog Reference:**
232+
- [Link to changelog section]
233+
- [Excerpt of relevant documentation]
234+
235+
### Error 2: [Error Type]
236+
[Repeat for each distinct error]
237+
238+
## Investigation Steps Taken
239+
1. [Step 1]
240+
2. [Step 2]
241+
3. [Step 3]
242+
243+
## Recommendations
244+
- [Suggest next steps]
245+
- [Identify if this is a bug in gh-aw or requires repository changes]
246+
- [Link to relevant documentation or issues]
247+
248+
## Additional Context
249+
- Changelog review: [Link to CHANGELOG.md]
250+
- Migration guide: [Link if available]
251+
```
252+
253+
## Best Practices
254+
255+
1. **Always Review Changelog First**
256+
- Understanding breaking changes upfront saves time
257+
- Look for migration guides or specific upgrade instructions
258+
- Pay attention to deprecation warnings
259+
260+
2. **Fix Errors Incrementally**
261+
- Don't try to fix everything at once
262+
- Validate each fix before moving to the next
263+
- Group similar errors and fix them together
264+
265+
3. **Test Thoroughly**
266+
- Compile workflows to verify fixes
267+
- Check that all lock files are generated
268+
- Review the generated YAML for correctness
269+
270+
4. **Document Everything**
271+
- Keep track of all changes made
272+
- Explain why changes were necessary
273+
- Reference specific changelog entries
274+
275+
5. **Clear Communication**
276+
- Use emojis to make output engaging
277+
- Summarize complex changes clearly
278+
- Provide actionable next steps
279+
280+
## Important Notes
281+
282+
- When running in GitHub Copilot Cloud, use the **agentic-workflows** MCP tool for all commands
283+
- When running in environments with `gh aw` CLI access, prefix commands with `gh aw`
284+
- Breaking changes are inevitable - expect to make manual fixes
285+
- If stuck, create an issue with detailed information for the maintainers

0 commit comments

Comments
 (0)