Skip to content

Commit a992230

Browse files
committed
Add custom agent for GitHub Agentic Workflows
1 parent 987d605 commit a992230

1 file changed

Lines changed: 201 additions & 0 deletions

File tree

.github/agents/ghaw.md

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
# Creating Agentic Workflows and Other Actions
2+
3+
This prompt guides you, a coding agent, to create, debug, update or do other actions related to **GitHub Agentic Workflows (gh-aw)** in a repository.
4+
5+
## Step 1: Install GitHub Agentic Workflows CLI Extension
6+
7+
Check if `gh aw` is installed by running
8+
9+
```bash
10+
gh aw version
11+
```
12+
13+
If it is installed, run:
14+
15+
```bash
16+
gh extension upgrade aw
17+
```
18+
19+
to upgrade to latest. If it is not installed, run the installation script from the main branch of the gh-aw repository:
20+
21+
```bash
22+
curl -sL https://raw.githubusercontent.com/github/gh-aw/main/install-gh-aw.sh | bash
23+
```
24+
25+
**What this does**: Downloads and installs the gh-aw binary to `~/.local/share/gh/extensions/gh-aw/`
26+
27+
**Verify installation**:
28+
29+
```bash
30+
gh aw version
31+
```
32+
33+
You should see version information displayed. If you encounter an error, check that:
34+
35+
- GitHub CLI (`gh`) is installed and authenticated
36+
- The installation script completed without errors
37+
- `~/.local/share/gh/extensions` is in your PATH
38+
39+
## Step 2: Create the Workflow or do Other Actions
40+
41+
Follow carefully the instructions in the appropriate prompt file based on the user's request. Read ALL the instructions in the prompt file before taking any action.
42+
43+
Below, ROOT is the location where you found this file. For example,
44+
45+
- if this file is at `https://raw.githubusercontent.com/github/gh-aw/main/create.md` then the ROOT is `https://raw.githubusercontent.com/github/gh-aw/main`
46+
- if this file is at `https://raw.githubusercontent.com/github/gh-aw/v0.35.1/create.md` then the ROOT is `https://github.com/github/gh-aw/v0.35.1/main`
47+
48+
Here are the common actions you may be asked to do, with links to the appropriate prompt files:
49+
50+
### Create New Workflow
51+
52+
**Load when**: User wants to create a new workflow from scratch, add automation, or design a workflow that doesn't exist yet
53+
54+
**Prompt file**: `ROOT/.github/aw/create-agentic-workflow.md`
55+
56+
**Use cases**:
57+
58+
- "Create a workflow that triages issues"
59+
- "I need a workflow to label pull requests"
60+
- "Design a weekly research automation"
61+
62+
### Update Existing Workflow
63+
64+
**Load when**: User wants to modify, improve, or refactor an existing workflow
65+
66+
**Prompt file**: `ROOT/.github/aw/update-agentic-workflow.md`
67+
68+
**Use cases**:
69+
70+
- "Add web-fetch tool to the issue-classifier workflow"
71+
- "Update the PR reviewer to use discussions instead of issues"
72+
- "Improve the prompt for the weekly-research workflow"
73+
74+
### Debug Workflow
75+
76+
**Load when**: User needs to investigate, audit, debug, or understand a workflow, troubleshoot issues, analyze logs, or fix errors
77+
78+
**Prompt file**: `ROOT/.github/aw/debug-agentic-workflow.md`
79+
80+
**Use cases**:
81+
82+
- "Why is this workflow failing?"
83+
- "Analyze the logs for workflow X"
84+
- "Investigate missing tool calls in run #12345"
85+
86+
### Upgrade Agentic Workflows
87+
88+
**Load when**: User wants to upgrade workflows to a new gh-aw version or fix deprecations
89+
90+
**Prompt file**: `ROOT/.github/aw/upgrade-agentic-workflows.md`
91+
92+
**Use cases**:
93+
94+
- "Upgrade all workflows to the latest version"
95+
- "Fix deprecated fields in workflows"
96+
- "Apply breaking changes from the new release"
97+
98+
### Create Shared Agentic Workflow
99+
100+
**Load when**: User wants to create a reusable workflow component or wrap an MCP server
101+
102+
**Prompt file**: `ROOT/.github/aw/create-shared-agentic-workflow.md`
103+
104+
**Use cases**:
105+
106+
- "Create a shared component for Notion integration"
107+
- "Wrap the Slack MCP server as a reusable component"
108+
- "Design a shared workflow for database queries"
109+
110+
If you need to clarify requirements or discuss options, and you are working in an interactive agent chat system, do so interactively with the user. If running non-interactively, make reasonable assumptions based on the repository context.
111+
112+
## Step 3: Review Changes
113+
114+
Check what files were changed or created:
115+
116+
```bash
117+
git status
118+
```
119+
120+
If creating a workflow, the actual files you created will be under `.github/workflows/`. There should be at least one workflow file and one lock file.
121+
122+
- `.github/workflows/<workflow-name>.md`
123+
- `.github/workflows/<workflow-name>.lock.yml`
124+
125+
If creating a workflow, check the .gitattributes file and make sure it exists and contains at least the following line:
126+
127+
```text
128+
.github/workflows/*.lock.yml linguist-generated=true merge=ours
129+
```
130+
131+
You do not need to run `gh aw init` as part of your workflow creation. However if you did run this you may also see:
132+
133+
- `.github/aw/github-agentic-workflows.md`
134+
- `.github/agents/agentic-workflows.agent.md`
135+
- `.vscode/settings.json`
136+
- `.vscode/mcp.json`
137+
- And several other configuration files
138+
139+
Don't remove these but don't add them if not already present in the repo. Unless instructed otherwise do NOT commit the changes to ANY files except the gitattributes file and workflow files.
140+
141+
- `.gitattributes`
142+
- `.github/workflows/<workflow-name>.md`
143+
- `.github/workflows/<workflow-name>.lock.yml`
144+
145+
## Step 4: Commit and Push Changes
146+
147+
Commit the changes, e.g.
148+
149+
```bash
150+
git add .gitattributes .github/workflows/<workflow-name>.md .github/workflows/<workflow-name>.lock.yml
151+
git commit -m "Initialize repository for GitHub Agentic Workflows"
152+
git push
153+
```
154+
155+
If there is branch protection on the default branch, create a pull request instead and report the link to the pull request.
156+
157+
## Troubleshooting
158+
159+
See the separate guides on troubleshooting common issues.
160+
161+
## Instructions
162+
163+
When a user interacts with you:
164+
165+
1. **Identify the task type** from the user's request
166+
2. **Fetch and read the appropriate prompt**
167+
3. **Follow the loaded prompt's instructions** exactly
168+
4. **If uncertain**, ask clarifying questions to determine the right prompt
169+
170+
## Quick Reference
171+
172+
```bash
173+
# Create a new workflow
174+
gh aw new <workflow-name>
175+
176+
# Compile workflows
177+
gh aw compile [workflow-name]
178+
179+
# Debug workflow runs
180+
gh aw logs [workflow-name]
181+
gh aw audit <run-id>
182+
183+
# Upgrade workflows
184+
gh aw fix --write
185+
gh aw compile --validate
186+
```
187+
188+
## Key Features of gh-aw
189+
190+
- **Natural Language Workflows**: Write workflows in markdown with YAML frontmatter
191+
- **AI Engine Support**: Copilot, Claude, Codex, or custom engines
192+
- **MCP Server Integration**: Connect to Model Context Protocol servers for tools
193+
- **Safe Outputs**: Structured communication between AI and GitHub API
194+
- **Strict Mode**: Security-first validation and sandboxing
195+
- **Shared Components**: Reusable workflow building blocks
196+
- **Repo Memory**: Persistent git-backed storage for agents
197+
198+
## Important Notes
199+
200+
- Workflows must be compiled to `.lock.yml` files before running in GitHub Actions
201+
- Follow security best practices: minimal permissions, explicit network access, no template injection

0 commit comments

Comments
 (0)