Skip to content

Commit 86ff05e

Browse files
Copilotpelikhan
andauthored
Treat gh aw as a first-class runtime with release setup-cli injection, dev source build, and firewall domains (#31622)
* Add gh-aw runtime detection and setup-cli mapping Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Address review feedback for gh-aw runtime Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Plan for addressing PR review feedback Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Use build/compiler version for gh-aw runtime default Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Refine gh-aw runtime default version resolution Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Pin gh-aw setup-cli refs in lock workflows Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Build gh-aw runtime from source in dev mode Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Strengthen dev-mode gh-aw runtime test assertions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Cover gh-aw version check in dev runtime test Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 9b2fe41 commit 86ff05e

14 files changed

Lines changed: 272 additions & 8 deletions

.github/workflows/copilot-token-audit.lock.yml

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/copilot-token-optimizer.lock.yml

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/static-analysis-report.lock.yml

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/workflow/compiler_yaml_main_job_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,40 @@ func TestGenerateMainJobStepsWithDevMode(t *testing.T) {
726726
}
727727
}
728728

729+
func TestGenerateMainJobStepsWithDevMode_GhAwRuntimeBuildsFromSource(t *testing.T) {
730+
originalRelease := IsRelease()
731+
t.Cleanup(func() {
732+
SetIsRelease(originalRelease)
733+
})
734+
SetIsRelease(false)
735+
736+
compiler := NewCompiler()
737+
compiler.actionMode = ActionModeDev
738+
compiler.stepOrderTracker = NewStepOrderTracker()
739+
740+
data := &WorkflowData{
741+
Name: "Test Workflow",
742+
AI: "copilot",
743+
MarkdownContent: "Test prompt",
744+
EngineConfig: &EngineConfig{
745+
ID: "copilot",
746+
},
747+
ParsedTools: NewTools(nil),
748+
Runtimes: map[string]any{
749+
"gh-aw": map[string]any{},
750+
},
751+
}
752+
753+
var yaml strings.Builder
754+
err := compiler.generateMainJobSteps(&yaml, data)
755+
require.NoError(t, err, "generateMainJobSteps should not error in dev mode with gh-aw runtime")
756+
757+
result := yaml.String()
758+
assert.Contains(t, result, "- name: Build and install gh-aw CLI from source")
759+
assert.Contains(t, result, "gh extension install .")
760+
assert.NotContains(t, result, "uses: github/gh-aw/actions/setup-cli@")
761+
}
762+
729763
// TestGenerateMainJobStepsStepOrdering tests step ordering validation
730764
func TestGenerateMainJobStepsStepOrdering(t *testing.T) {
731765
compiler := NewCompiler()

pkg/workflow/data/ecosystem_domains.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@
120120
"productionresultssa18.blob.core.windows.net",
121121
"productionresultssa19.blob.core.windows.net"
122122
],
123+
"gh-aw": [
124+
"codeload.github.com",
125+
"github.com",
126+
"github.github.com",
127+
"raw.githubusercontent.com"
128+
],
123129
"go": ["go.dev", "golang.org", "proxy.golang.org", "sum.golang.org", "pkg.go.dev", "goproxy.io", "storage.googleapis.com"],
124130
"haskell": ["haskell.org", "*.hackage.haskell.org", "get-ghcup.haskell.org", "downloads.haskell.org"],
125131
"java": [

pkg/workflow/domains.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ var runtimeToEcosystem = map[string]string{
380380
"ruby": "ruby",
381381
"dotnet": "dotnet",
382382
"haskell": "haskell",
383+
"gh-aw": "gh-aw",
383384
"bun": "node", // bun.sh is in the node ecosystem
384385
"deno": "node", // deno.land is in the node ecosystem
385386
"uv": "python", // uv is a Python package manager

pkg/workflow/frontmatter_parsing.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ func parseRuntimesConfig(runtimes map[string]any) (*RuntimesConfig, error) {
160160
config.Dotnet = runtimeConfig
161161
case "elixir":
162162
config.Elixir = runtimeConfig
163+
case "gh-aw":
164+
config.GhAw = runtimeConfig
163165
case "haskell":
164166
config.Haskell = runtimeConfig
165167
case "java":

pkg/workflow/frontmatter_serialization.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ func countRuntimes(config *RuntimesConfig) int {
2424
if config.Deno != nil {
2525
count++
2626
}
27+
if config.GhAw != nil {
28+
count++
29+
}
2730
return count
2831
}
2932

@@ -267,6 +270,7 @@ func runtimesConfigToMap(config *RuntimesConfig) map[string]any {
267270
{"deno", config.Deno},
268271
{"dotnet", config.Dotnet},
269272
{"elixir", config.Elixir},
273+
{"gh-aw", config.GhAw},
270274
{"haskell", config.Haskell},
271275
{"java", config.Java},
272276
{"ruby", config.Ruby},

pkg/workflow/frontmatter_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type RuntimesConfig struct {
2626
Deno *RuntimeConfig `json:"deno,omitempty"` // Deno runtime
2727
Dotnet *RuntimeConfig `json:"dotnet,omitempty"` // .NET runtime
2828
Elixir *RuntimeConfig `json:"elixir,omitempty"` // Elixir runtime
29+
GhAw *RuntimeConfig `json:"gh-aw,omitempty"` // gh-aw CLI runtime
2930
Haskell *RuntimeConfig `json:"haskell,omitempty"` // Haskell runtime
3031
Java *RuntimeConfig `json:"java,omitempty"` // Java runtime
3132
Ruby *RuntimeConfig `json:"ruby,omitempty"` // Ruby runtime

pkg/workflow/runtime_definitions.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ var knownRuntimes = []*Runtime{
8888
},
8989
ManifestFiles: []string{"go.mod", "go.sum"},
9090
},
91+
{
92+
ID: "gh-aw",
93+
Name: "gh-aw CLI",
94+
ActionRepo: "github/gh-aw/actions/setup-cli",
95+
ActionVersion: "v0.72.1",
96+
VersionField: "version",
97+
// Default version is computed at generation time from the current gh-aw build.
98+
DefaultVersion: "",
99+
Commands: []string{"gh-aw"},
100+
ManifestFiles: nil,
101+
},
91102
{
92103
ID: "haskell",
93104
Name: "Haskell",

0 commit comments

Comments
 (0)