MCPcopy Create free account
hub / github.com/github/gh-aw / createWorkflowTemplate

Function createWorkflowTemplate

pkg/cli/commands.go:84–141  ·  view source on GitHub ↗

createWorkflowTemplate generates a concise workflow template with essential options

(workflowName string, engine string)

Source from the content-addressed store, hash-verified

82
83// createWorkflowTemplate generates a concise workflow template with essential options
84func createWorkflowTemplate(workflowName string, engine string) string {
85 engineLine := ""
86 if engine != "" {
87 engineLine = "\n# AI engine to use for this workflow\nengine: " + engine + "\n"
88 }
89 return `---
90# Trigger - when should this workflow run?
91on:
92 workflow_dispatch: # Manual trigger
93
94# Alternative triggers (uncomment to use):
95# on:
96# issues:
97# types: [opened, reopened]
98# pull_request:
99# types: [opened, synchronize]
100# schedule: daily # Fuzzy daily schedule (scattered execution time)
101# # schedule: weekly on monday # Fuzzy weekly schedule
102
103# Permissions - what can this workflow access?
104# Write operations (creating issues, PRs, comments, etc.) are handled
105# automatically by the safe-outputs job with its own scoped permissions.
106permissions:
107 contents: read
108 issues: read
109 pull-requests: read
110` + engineLine + `
111# Tools - GitHub API access via toolsets (context, repos, issues, pull_requests)
112# tools:
113# github:
114# toolsets: [default]
115
116# Network access
117network: defaults
118
119` + buildSafeOutputsSection() + `
120---
121
122# ` + workflowName + `
123
124Describe what you want the AI to do when this workflow runs.
125
126## Instructions
127
128Replace this section with specific instructions for the AI. For example:
129
1301. Read the issue description and comments
1312. Analyze the request and gather relevant information
1323. Provide a helpful response or take appropriate action
133
134Be clear and specific about what the AI should accomplish.
135
136## Notes
137
138- Run ` + "`" + string(constants.CLIExtensionPrefix) + " compile`" + ` to generate the GitHub Actions workflow
139- See https://github.github.com/gh-aw/ for complete configuration options and tools documentation
140`
141}

Calls 1

buildSafeOutputsSectionFunction · 0.85