Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/agent-performance-analyzer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/agent-persona-explorer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/audit-workflows.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/cloclo.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/daily-cli-tools-tester.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/daily-firewall-report.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/daily-observability-report.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/daily-safe-output-optimizer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/deep-report.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/dev-hawk.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/example-workflow-analyzer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/mcp-inspector.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/metrics-collector.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/portfolio-analyst.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/prompt-clustering-analysis.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/python-data-charts.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/q.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/safe-output-health.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/security-review.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/smoke-claude.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/smoke-copilot-arm.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/smoke-copilot.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/static-analysis-report.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/workflows/workflow-normalizer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions actions/setup/md/agentic_workflows_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<agentic-workflows-guide>
## Using the agentic-workflows MCP Server

**⚠️ CRITICAL**: The `status`, `logs`, `audit`, and `compile` operations are MCP server tools,
NOT shell commands. Do NOT run `gh aw` directly — it is not authenticated in this context.
Do not attempt to download or build the `gh aw` extension. If the MCP server fails, give up.
Call all operations as MCP tools with JSON parameters.

- Run the `status` tool to verify configuration and list all workflows
- Use the `logs` tool to download run logs (saves to `/tmp/gh-aw/aw-mcp/logs/`)
- Use the `audit` tool with a run ID or URL to investigate specific runs

### Tool Parameters

#### `status` — Verify MCP server configuration and list workflows

#### `logs` — Download workflow run logs
- `workflow_name`: filter to a specific workflow (leave empty for all)
- `count`: number of runs (default: 100)
- `start_date`: filter runs after this date (YYYY-MM-DD or relative like `-1d`, `-7d`, `-30d`)
- `end_date`: filter runs before this date
- `engine`: filter by AI engine (`copilot`, `claude`, `codex`)
- `branch`: filter by branch name
- `firewall` / `no_firewall`: filter by firewall status
- `after_run_id` / `before_run_id`: paginate by run database ID
- Logs are saved to `/tmp/gh-aw/aw-mcp/logs/`

#### `audit` — Inspect a specific run
- `run_id_or_url`: numeric run ID, run URL, job URL, or job URL with step anchor
</agentic-workflows-guide>
1 change: 1 addition & 0 deletions pkg/workflow/prompt_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const (
safeOutputsCreatePRFile = "safe_outputs_create_pull_request.md"
safeOutputsPushToBranchFile = "safe_outputs_push_to_pr_branch.md"
safeOutputsAutoCreateIssueFile = "safe_outputs_auto_create_issue.md"
agenticWorkflowsGuideFile = "agentic_workflows_guide.md"
)

// GitHub context prompt is kept embedded because it contains GitHub Actions expressions
Expand Down
15 changes: 15 additions & 0 deletions pkg/workflow/prompts.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ func hasPlaywrightTool(parsedTools *Tools) bool {
return hasPlaywright
}

// ============================================================================
// Tool Prompts - Agentic Workflows
// ============================================================================

// hasAgenticWorkflowsTool checks if the agentic workflows tool is enabled in the tools configuration
func hasAgenticWorkflowsTool(parsedTools *Tools) bool {
if parsedTools == nil {
log.Print("Checking for agentic-workflows tool: no parsed tools provided")
return false
}
hasAgenticWorkflows := parsedTools.AgenticWorkflows != nil
log.Printf("Agentic-workflows tool enabled: %v", hasAgenticWorkflows)
return hasAgenticWorkflows
}

// ============================================================================
// PR Context Prompts
// ============================================================================
Expand Down
98 changes: 98 additions & 0 deletions pkg/workflow/prompts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,3 +750,101 @@ This is a test workflow without contents read permission.

t.Logf("Successfully verified PR context instructions are NOT included without contents permission")
}

// ============================================================================
// Agentic Workflows Guide Prompt Tests
// ============================================================================

func TestAgenticWorkflowsGuideIncludedWhenEnabled(t *testing.T) {
tmpDir, err := os.MkdirTemp("", "gh-aw-agentic-guide-test-*")
if err != nil {
t.Fatalf("Failed to create temp dir: %v", err)
}
defer os.RemoveAll(tmpDir)

testFile := filepath.Join(tmpDir, "test-workflow.md")
testContent := `---
on: schedule daily
engine: claude
tools:
agentic-workflows:
permissions:
actions: read
---

# Test Workflow with Agentic Workflows

This workflow uses the agentic-workflows MCP server.
`

if err := os.WriteFile(testFile, []byte(testContent), 0644); err != nil {
t.Fatalf("Failed to create test workflow: %v", err)
}

compiler := NewCompiler()
if err := compiler.CompileWorkflow(testFile); err != nil {
t.Fatalf("Failed to compile workflow: %v", err)
}

lockFile := stringutil.MarkdownToLockFile(testFile)
lockContent, err := os.ReadFile(lockFile)
if err != nil {
t.Fatalf("Failed to read generated lock file: %v", err)
}

lockStr := string(lockContent)

if !strings.Contains(lockStr, "- name: Create prompt with built-in context") {
t.Error("Expected 'Create prompt with built-in context' step in generated workflow")
}

if !strings.Contains(lockStr, "cat \"/opt/gh-aw/prompts/agentic_workflows_guide.md\"") {
t.Error("Expected cat command for agentic_workflows_guide.md in generated workflow")
}

t.Logf("Successfully verified agentic-workflows guide is included when agentic-workflows tool is enabled")
}

func TestAgenticWorkflowsGuideNotIncludedWhenDisabled(t *testing.T) {
tmpDir, err := os.MkdirTemp("", "gh-aw-no-agentic-guide-test-*")
if err != nil {
t.Fatalf("Failed to create temp dir: %v", err)
}
defer os.RemoveAll(tmpDir)

testFile := filepath.Join(tmpDir, "test-workflow.md")
testContent := `---
on: push
engine: codex
tools:
github:
---

# Test Workflow without Agentic Workflows

This workflow does not use the agentic-workflows MCP server.
`

if err := os.WriteFile(testFile, []byte(testContent), 0644); err != nil {
t.Fatalf("Failed to create test workflow: %v", err)
}

compiler := NewCompiler()
if err := compiler.CompileWorkflow(testFile); err != nil {
t.Fatalf("Failed to compile workflow: %v", err)
}

lockFile := stringutil.MarkdownToLockFile(testFile)
lockContent, err := os.ReadFile(lockFile)
if err != nil {
t.Fatalf("Failed to read generated lock file: %v", err)
}

lockStr := string(lockContent)

if strings.Contains(lockStr, "agentic_workflows_guide.md") {
t.Error("Did not expect 'agentic_workflows_guide.md' reference in workflow without agentic-workflows tool")
}

t.Logf("Successfully verified agentic-workflows guide is NOT included when agentic-workflows tool is disabled")
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ jobs:
cat "/opt/gh-aw/prompts/temp_folder_prompt.md"
cat "/opt/gh-aw/prompts/markdown.md"
cat "/opt/gh-aw/prompts/playwright_prompt.md"
cat "/opt/gh-aw/prompts/agentic_workflows_guide.md"
cat << 'GH_AW_PROMPT_EOF'
<github-context>
The following GitHub context information is available for this workflow:
Expand Down
Loading
Loading