Skip to content

Commit 3bfeba6

Browse files
[copilot] Add /review GitHub agentic workflow (#346)
Port the android-tools-reviewer from a Copilot CLI skill to a GitHub Agentic Workflow triggered by the `/review` slash command on pull requests. The workflow performs automated code review using the existing review rules and posts findings as inline review comments and a review summary via safe-outputs. Changes: - Create `.github/workflows/android-tools-reviewer.md` with slash_command trigger, read-only permissions, claude-opus-4.6 model, network allowlist, min-integrity: none for external contributors, roles restriction to admin/maintainer/write, and safe-outputs for PR review comments and review submission - Create `.github/agents/agentic-workflows.agent.md` dispatcher - Create `.github/aw/actions-lock.json` for pinned action SHAs - Compile `.github/workflows/android-tools-reviewer.lock.yml` - Update SKILL.md to remove submit_review.cs script workflow and add CI status checking, Copilot-authored PR handling, and direct review posting via safe-outputs - Delete `.github/skills/android-tools-reviewer/scripts/submit_review.cs` (no longer needed β€” the workflow uses safe-outputs instead of gh api) - Update `copilot-setup-steps.yml` to install gh-aw CLI extension and bump actions/checkout to v6 - Update `.gitattributes` to mark lock files as linguist-generated - Remove stale `submit_review.cs` reference from copilot-instructions.md ## Match full agentic-workflows.agent.md from dotnet/android Add missing sections: Problems This Solves, How to Use, Key Features, Important Notes, and detailed Load when / Use cases per prompt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2fd1240 commit 3bfeba6

9 files changed

Lines changed: 1587 additions & 195 deletions

File tree

β€Ž.gitattributesβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*.Designer.cs eol=crlf
22
*.resx text
3-
*.xlf text
3+
*.xlf text
4+
5+
.github/workflows/*.lock.yml linguist-generated=true merge=ours
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
description: GitHub Agentic Workflows (gh-aw) - Create, debug, and upgrade AI-powered workflows with intelligent prompt routing
3+
disable-model-invocation: true
4+
---
5+
6+
# GitHub Agentic Workflows Agent
7+
8+
This agent helps you work with **GitHub Agentic Workflows (gh-aw)**, a CLI extension for creating AI-powered workflows in natural language using markdown files.
9+
10+
## What This Agent Does
11+
12+
This is a **dispatcher agent** that routes your request to the appropriate specialized prompt based on your task:
13+
14+
- **Creating new workflows**: Routes to `create` prompt
15+
- **Updating existing workflows**: Routes to `update` prompt
16+
- **Debugging workflows**: Routes to `debug` prompt
17+
- **Upgrading workflows**: Routes to `upgrade-agentic-workflows` prompt
18+
- **Creating report-generating workflows**: Routes to `report` prompt β€” consult this whenever the workflow posts status updates, audits, analyses, or any structured output as issues, discussions, or comments
19+
- **Creating shared components**: Routes to `create-shared-agentic-workflow` prompt
20+
- **Fixing Dependabot PRs**: Routes to `dependabot` prompt β€” use this when Dependabot opens PRs that modify generated manifest files (`.github/workflows/package.json`, `.github/workflows/requirements.txt`, `.github/workflows/go.mod`). Never merge those PRs directly; instead update the source `.md` files and rerun `gh aw compile --dependabot` to bundle all fixes
21+
- **Analyzing test coverage**: Routes to `test-coverage` prompt β€” consult this whenever the workflow reads, analyzes, or reports on test coverage data from PRs or CI runs
22+
23+
Workflows may optionally include:
24+
25+
- **Project tracking / monitoring** (GitHub Projects updates, status reporting)
26+
- **Orchestration / coordination** (one workflow assigning agents or dispatching and coordinating other workflows)
27+
28+
## Files This Applies To
29+
30+
- Workflow files: `.github/workflows/*.md` and `.github/workflows/**/*.md`
31+
- Workflow lock files: `.github/workflows/*.lock.yml`
32+
- Shared components: `.github/workflows/shared/*.md`
33+
- Configuration: https://github.com/github/gh-aw/blob/v0.68.3/.github/aw/github-agentic-workflows.md
34+
35+
## Problems This Solves
36+
37+
- **Workflow Creation**: Design secure, validated agentic workflows with proper triggers, tools, and permissions
38+
- **Workflow Debugging**: Analyze logs, identify missing tools, investigate failures, and fix configuration issues
39+
- **Version Upgrades**: Migrate workflows to new gh-aw versions, apply codemods, fix breaking changes
40+
- **Component Design**: Create reusable shared workflow components that wrap MCP servers
41+
42+
## How to Use
43+
44+
When you interact with this agent, it will:
45+
46+
1. **Understand your intent** - Determine what kind of task you're trying to accomplish
47+
2. **Route to the right prompt** - Load the specialized prompt file for your task
48+
3. **Execute the task** - Follow the detailed instructions in the loaded prompt
49+
50+
## Available Prompts
51+
52+
### Create New Workflow
53+
**Load when**: User wants to create a new workflow from scratch, add automation, or design a workflow that doesn't exist yet
54+
55+
**Prompt file**: https://github.com/github/gh-aw/blob/v0.68.3/.github/aw/create-agentic-workflow.md
56+
57+
**Use cases**:
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+
**Load when**: User wants to modify, improve, or refactor an existing workflow
64+
65+
**Prompt file**: https://github.com/github/gh-aw/blob/v0.68.3/.github/aw/update-agentic-workflow.md
66+
67+
**Use cases**:
68+
- "Add web-fetch tool to the issue-classifier workflow"
69+
- "Update the PR reviewer to use discussions instead of issues"
70+
- "Improve the prompt for the weekly-research workflow"
71+
72+
### Debug Workflow
73+
**Load when**: User needs to investigate, audit, debug, or understand a workflow, troubleshoot issues, analyze logs, or fix errors
74+
75+
**Prompt file**: https://github.com/github/gh-aw/blob/v0.68.3/.github/aw/debug-agentic-workflow.md
76+
77+
**Use cases**:
78+
- "Why is this workflow failing?"
79+
- "Analyze the logs for workflow X"
80+
- "Investigate missing tool calls in run #12345"
81+
82+
### Upgrade Agentic Workflows
83+
**Load when**: User wants to upgrade workflows to a new gh-aw version or fix deprecations
84+
85+
**Prompt file**: https://github.com/github/gh-aw/blob/v0.68.3/.github/aw/upgrade-agentic-workflows.md
86+
87+
**Use cases**:
88+
- "Upgrade all workflows to the latest version"
89+
- "Fix deprecated fields in workflows"
90+
- "Apply breaking changes from the new release"
91+
92+
### Create a Report-Generating Workflow
93+
**Load when**: The workflow being created or updated produces reports β€” recurring status updates, audit summaries, analyses, or any structured output posted as a GitHub issue, discussion, or comment
94+
95+
**Prompt file**: https://github.com/github/gh-aw/blob/v0.68.3/.github/aw/report.md
96+
97+
**Use cases**:
98+
- "Create a weekly CI health report"
99+
- "Post a daily security audit to Discussions"
100+
- "Add a status update comment to open PRs"
101+
102+
### Create Shared Agentic Workflow
103+
**Load when**: User wants to create a reusable workflow component or wrap an MCP server
104+
105+
**Prompt file**: https://github.com/github/gh-aw/blob/v0.68.3/.github/aw/create-shared-agentic-workflow.md
106+
107+
**Use cases**:
108+
- "Create a shared component for Notion integration"
109+
- "Wrap the Slack MCP server as a reusable component"
110+
- "Design a shared workflow for database queries"
111+
112+
### Fix Dependabot PRs
113+
**Load when**: User needs to close or fix open Dependabot PRs that update dependencies in generated manifest files (`.github/workflows/package.json`, `.github/workflows/requirements.txt`, `.github/workflows/go.mod`)
114+
115+
**Prompt file**: https://github.com/github/gh-aw/blob/v0.68.3/.github/aw/dependabot.md
116+
117+
**Use cases**:
118+
- "Fix the open Dependabot PRs for npm dependencies"
119+
- "Bundle and close the Dependabot PRs for workflow dependencies"
120+
- "Update @playwright/test to fix the Dependabot PR"
121+
122+
### Analyze Test Coverage
123+
**Load when**: The workflow reads, analyzes, or reports test coverage β€” whether triggered by a PR, a schedule, or a slash command. Always consult this prompt before designing the coverage data strategy.
124+
125+
**Prompt file**: https://github.com/github/gh-aw/blob/v0.68.3/.github/aw/test-coverage.md
126+
127+
**Use cases**:
128+
- "Create a workflow that comments coverage on PRs"
129+
- "Analyze coverage trends over time"
130+
- "Add a coverage gate that blocks PRs below a threshold"
131+
132+
## Instructions
133+
134+
When a user interacts with you:
135+
136+
1. **Identify the task type** from the user's request
137+
2. **Load the appropriate prompt** from the GitHub repository URLs listed above
138+
3. **Follow the loaded prompt's instructions** exactly
139+
4. **If uncertain**, ask clarifying questions to determine the right prompt
140+
141+
## Quick Reference
142+
143+
```bash
144+
# Initialize repository for agentic workflows
145+
gh aw init
146+
147+
# Generate the lock file for a workflow
148+
gh aw compile [workflow-name]
149+
150+
# Debug workflow runs
151+
gh aw logs [workflow-name]
152+
gh aw audit <run-id>
153+
154+
# Upgrade workflows
155+
gh aw fix --write
156+
gh aw compile --validate
157+
```
158+
159+
## Key Features of gh-aw
160+
161+
- **Natural Language Workflows**: Write workflows in markdown with YAML frontmatter
162+
- **AI Engine Support**: Copilot, Claude, Codex, or custom engines
163+
- **MCP Server Integration**: Connect to Model Context Protocol servers for tools
164+
- **Safe Outputs**: Structured communication between AI and GitHub API
165+
- **Strict Mode**: Security-first validation and sandboxing
166+
- **Shared Components**: Reusable workflow building blocks
167+
- **Repo Memory**: Persistent git-backed storage for agents
168+
- **Sandboxed Execution**: All workflows run in the Agent Workflow Firewall (AWF) sandbox, enabling full `bash` and `edit` tools by default
169+
170+
## Important Notes
171+
172+
- Always reference the instructions file at https://github.com/github/gh-aw/blob/v0.68.3/.github/aw/github-agentic-workflows.md for complete documentation
173+
- Use the MCP tool `agentic-workflows` when running in GitHub Copilot Cloud
174+
- Workflows must be compiled to `.lock.yml` files before running in GitHub Actions
175+
- **Bash tools are enabled by default** - Don't restrict bash commands unnecessarily since workflows are sandboxed by the AWF
176+
- Follow security best practices: minimal permissions, explicit network access, no template injection
177+
- **Network configuration**: Use ecosystem identifiers (`node`, `python`, `go`, etc.) or explicit FQDNs in `network.allowed`. Bare shorthands like `npm` or `pypi` are **not** valid. See https://github.com/github/gh-aw/blob/v0.68.3/.github/aw/network.md for the full list of valid ecosystem identifiers and domain patterns.
178+
- **Single-file output**: When creating a workflow, produce exactly **one** workflow `.md` file. Do not create separate documentation files (architecture docs, runbooks, usage guides, etc.). If documentation is needed, add a brief `## Usage` section inside the workflow file itself.

β€Ž.github/aw/actions-lock.jsonβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"entries": {
3+
"github/gh-aw-actions/setup@v0.68.3": {
4+
"repo": "github/gh-aw-actions/setup",
5+
"version": "v0.68.3",
6+
"sha": "ba90f2186d7ad780ec640f364005fa24e797b360"
7+
}
8+
}
9+
}

β€Ž.github/copilot-instructions.mdβ€Ž

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ dotnet test tests/Microsoft.Android.Build.BaseTasks-Tests/Microsoft.Android.Buil
2424

2525
Output: `bin\$(Configuration)\` (redistributables), `bin\Test$(Configuration)\` (tests). `$(DotNetTargetFrameworkVersion)` = `10.0` in `Directory.Build.props`. Versioning: `nuget.version` has `major.minor`; patch = git commit count since file changed.
2626

27-
## Running Scripts
28-
29-
This repo uses `dotnet run file.cs` (.NET 10+ feature) to execute standalone C# scripts with top-level statements β€” no `.csproj` needed. Example:
30-
31-
```sh
32-
dotnet run .github/skills/android-tools-reviewer/scripts/submit_review.cs -- arg1 arg2
33-
```
34-
3527
## Android Environment Variables
3628

3729
Per the [official Android docs](https://developer.android.com/tools/variables#envar):

β€Ž.github/skills/android-tools-reviewer/SKILL.mdβ€Ž

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ Flag severity clearly in every comment:
2323

2424
## Workflow
2525

26-
### 1. Parse the PR URL
26+
### 1. Identify the PR
2727

28-
Extract `owner`, `repo`, `pr_number` from the URL.
28+
If triggered from an agentic workflow (slash command on a PR), use the PR from the event context. Otherwise, extract `owner`, `repo`, `pr_number` from a URL or reference provided by the user.
2929
Formats: `https://github.com/{owner}/{repo}/pull/{number}`, `{owner}/{repo}#{number}`, or bare number (defaults to `dotnet/android-tools`).
3030

3131
### 2. Gather context (before reading PR description)
@@ -47,11 +47,22 @@ gh pr view {number} --repo {owner}/{repo} --json title,body
4747

4848
Now read the PR description and linked issues. Treat them as claims to verify, not facts to accept. Where your independent reading disagrees with the PR description, investigate further. If the PR claims a performance improvement, require evidence. If it claims a bug fix, verify the bug exists and the fix addresses root cause β€” not symptoms.
4949

50-
### 4. Load review rules
50+
### 4. Check CI status
51+
52+
```
53+
gh pr checks {number} --repo {owner}/{repo}
54+
```
55+
56+
Review the CI results. **Never post βœ… LGTM if any required CI check is failing or if the code doesn't build.** If CI is failing:
57+
- Investigate the failure.
58+
- If the failure is caused by the PR's code changes, flag it as ❌ error.
59+
- If the failure is a known infrastructure issue or pre-existing flake unrelated to the PR, note it in the summary but still use ⚠️ Needs Changes β€” the PR isn't mergeable until CI is green.
60+
61+
### 5. Load review rules
5162

5263
Read `references/review-rules.md` from this skill's directory.
5364

54-
### 5. Analyze the diff
65+
### 6. Analyze the diff
5566

5667
For each changed file, check against the review rules. Record issues as:
5768

@@ -67,38 +78,16 @@ Constraints:
6778
- **Don't flag what CI catches.** Skip compiler errors, formatting the linter will catch, etc.
6879
- **Avoid false positives.** Verify the concern actually applies given the full context. If unsure, phrase it as a question rather than a firm claim.
6980

70-
### 6. Build the review JSON
81+
### 7. Post the review
7182

72-
Write a temp JSON file:
83+
Post your findings directly:
7384

74-
```json
75-
{
76-
"event": "COMMENT",
77-
"body": "## πŸ€– AI Review Summary\n\n**Verdict**: βœ… LGTM | ⚠️ Needs Changes | ❌ Reject\n\nFound **N issues**: ...\n\n- ❌ **Category**: description (`file:line`)\n- ⚠️ **Category**: description (`file:line`)\n\nπŸ‘ Positive callouts.\n\n---\n_Review generated by android-tools-reviewer from [review guidelines](../../../docs/CODE_REVIEW_POSTMORTEM.md) by @jonathanpeppers._",
78-
"comments": [
79-
{
80-
"path": "src/Example.cs",
81-
"line": 42,
82-
"side": "RIGHT",
83-
"body": "πŸ€– ❌ **Error handling** β€” Every `catch` should capture the `Exception` and log it.\n\n_Rule: No empty catch blocks (Postmortem `#11`)_"
84-
}
85-
]
86-
}
87-
```
88-
89-
If no issues found, submit with empty `comments` and a positive summary.
90-
91-
### 7. Submit as a single batch
92-
93-
```powershell
94-
dotnet run {skill-dir}/scripts/submit_review.cs -- {owner} {repo} {number} {path-to-json}
95-
```
85+
- **Inline comments** on specific lines of the diff with the severity, category, and explanation.
86+
- **Review summary** with the overall verdict (βœ… LGTM, ⚠️ Needs Changes, or ❌ Reject), issue counts by severity, and positive callouts.
9687

97-
> **Note:** `dotnet run file.cs` is a .NET 10+ feature that runs standalone C# files
98-
> with top-level statements directly β€” no `.csproj` needed. Use `--` to separate
99-
> `dotnet run` flags from script arguments.
88+
If no issues found **and CI is green**, submit with at most one or two πŸ’‘ suggestions and a positive summary.
10089

101-
The script validates structure (required fields, πŸ€– prefix, positive line numbers) then calls `gh api`. Delete the temp file after success.
90+
**Copilot-authored PRs:** If the PR author is `Copilot` (the GitHub Copilot coding agent) and the verdict is ⚠️ Needs Changes or ❌ Reject, prefix the review summary with `@copilot ` so the comment automatically triggers Copilot to address the feedback. Do NOT add the prefix for βœ… LGTM verdicts.
10291

10392
## Comment format
10493

0 commit comments

Comments
Β (0)