feat(compile): add --actions-repo flag to override external actions repository#22437
feat(compile): add --actions-repo flag to override external actions repository#22437
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/7527c09a-4314-4fb2-b7cb-7880d6142096
…epository Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/7527c09a-4314-4fb2-b7cb-7880d6142096
|
@copilot add integrations tests in pkg/cli/workflows that ensure the args custom action id is baked into the lockfiles. |
|
@pelikhan Should we also add a parameter for specifying a specific branch? |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/1e3c241a-3103-4eeb-a668-afdb683e4c59
Added two integration tests in commit 99e168a:
The fixture workflow lives at Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
You can use |
There was a problem hiding this comment.
Pull request overview
Adds a new --actions-repo flag to gh aw compile so users can override the default external actions repository (github/gh-aw-actions) when compiling workflows in action mode (e.g., to point at a fork).
Changes:
- Introduces an actions repo override on the workflow
Compilerand threads it through action reference resolution. - Adds
--actions-repoto the CLI, wiring it intoCompileConfigand compiler setup. - Adds an integration-test fixture and tests to validate override behavior and default fallback.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/compiler_types.go | Adds actionsRepo state + getter/setter and a defaulting helper for the compiler. |
| pkg/workflow/action_reference.go | Refactors setup action resolution to accept an actions repo override; uses compiler’s effective repo in action-mode references. |
| pkg/cli/compile_config.go | Adds ActionsRepo to compile configuration. |
| pkg/cli/compile_compiler_setup.go | Applies ActionsRepo override to the compiler and adjusts --action-tag / --action-mode action precedence. |
| cmd/gh-aw/main.go | Registers --actions-repo flag and passes it through to CompileConfig. |
| pkg/cli/workflows/test-actions-repo.md | Adds a canonical workflow fixture for actions-repo integration tests. |
| pkg/cli/compile_integration_test.go | Adds integration tests for --actions-repo override and default fallback behavior. |
Comments suppressed due to low confidence (2)
cmd/gh-aw/main.go:651
- --actions-repo is accepted as an arbitrary string and then used to construct "uses:" references and resolver lookups. Consider validating it early (e.g., in validateCompileConfig) to ensure it is a plain "owner/repo" slug (no whitespace, no '@', exactly one '/'), and return a clear error if invalid to avoid generating broken workflows.
compileCmd.Flags().String("actions-repo", "", "Override the external actions repository used in action mode (default: github/gh-aw-actions). Example: --actions-repo myorg/my-aw-actions")
cmd/gh-aw/main.go:649
- The --action-mode flag help text lists only "inline, dev, release", but validateActionModeConfig (pkg/cli/compile_validation.go:231-234) accepts "dev", "release", "script", and "action". Update the help string to include the full set of supported modes so users can discover "script"/"action" via --help.
compileCmd.Flags().String("action-mode", "", "Action script inlining mode (inline, dev, release). Auto-detected if not specified")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -646,6 +648,7 @@ Use "` + string(constants.CLIExtensionPrefix) + ` help all" to show help for all | |||
| compileCmd.Flags().StringP("engine", "e", "", "Override AI engine (claude, codex, copilot, custom)") | |||
| compileCmd.Flags().String("action-mode", "", "Action script inlining mode (inline, dev, release). Auto-detected if not specified") | |||
| compileCmd.Flags().String("action-tag", "", "Override action SHA or tag for actions/setup (overrides action-mode to release). Accepts full SHA or tag name") | |||
There was a problem hiding this comment.
The --action-tag flag help text says it always overrides --action-mode to release, but setupActionMode now keeps action mode when the user explicitly sets --action-mode action. Please update this help text (and any related docs/comments) to reflect the new precedence so the CLI help matches actual behavior.
This issue also appears in the following locations of the same file:
- line 651
- line 649
| compileCmd.Flags().String("action-tag", "", "Override action SHA or tag for actions/setup (overrides action-mode to release). Accepts full SHA or tag name") | |
| compileCmd.Flags().String("action-tag", "", "Override action SHA or tag for actions/setup. When set without --action-mode, defaults action-mode to release. Accepts full SHA or tag name") |
| @@ -32,6 +32,7 @@ type CompileConfig struct { | |||
| JSONOutput bool // Output validation results as JSON | |||
| ActionMode string // Action script inlining mode: inline, dev, or release | |||
| ActionTag string // Override action SHA or tag for actions/setup (overrides action-mode to release) | |||
There was a problem hiding this comment.
CompileConfig.ActionTag is documented as always overriding action-mode to release, but setupActionMode now keeps action mode when --action-mode action is explicitly set. Update this field comment to match the current precedence rules so callers don’t rely on outdated semantics.
| ActionTag string // Override action SHA or tag for actions/setup (overrides action-mode to release) | |
| ActionTag string // Override action SHA or tag for actions/setup (forces release mode unless action-mode is explicitly set to 'action') |
| @@ -81,6 +81,7 @@ type Compiler struct { | |||
| markdownPath string // Path to the markdown file being compiled (for context in dynamic tool generation) | |||
| actionMode ActionMode // Mode for generating JavaScript steps (inline vs custom actions) | |||
| actionTag string // Override action SHA or tag for actions/setup (when set, overrides actionMode to release) | |||
There was a problem hiding this comment.
Compiler.actionTag is commented as overriding actionMode to release, but setupActionMode now preserves ActionModeAction when explicitly requested alongside an action tag. Please update this struct field comment to reflect the current precedence (action-tag pins the version; it only forces release when action-mode isn’t explicitly set to action).
| actionTag string // Override action SHA or tag for actions/setup (when set, overrides actionMode to release) | |
| actionTag string // Override action SHA or tag for actions/setup; pins the version and only forces release when actionMode is not explicitly set to action |
Summary
Adds a new
--actions-repoflag to thecompilecommand that allows users to specify a custom external actions repository instead of the hardcoded defaultgithub/gh-aw-actions.Motivation
When running
gh aw compilein action mode, all action references in the compiled.lock.ymlfiles point togithub/gh-aw-actions. This new flag allows users to override that repository, for example to use a fork or a custom deployment of the actions.Changes
pkg/workflow/compiler_types.go: AddedactionsRepo stringfield toCompilerstruct withSetActionsRepo/GetActionsRepopublic methods and aneffectiveActionsRepo()internal helper that returns the override if set, otherwise falls back to theGitHubActionsOrgRepoconstant.pkg/workflow/action_reference.go: Extracted internalresolveSetupActionReffunction that accepts anactionsOrgRepooverride parameter. Kept the existing publicResolveSetupActionReferenceas a no-arg-change wrapper (backward compatible). Updated the compiler'sresolveActionReferenceandconvertToExternalActionsRefmethods to usec.effectiveActionsRepo().pkg/cli/compile_config.go: AddedActionsRepo stringfield toCompileConfig.pkg/cli/compile_compiler_setup.go: Callscompiler.SetActionsRepo(config.ActionsRepo)increateAndConfigureCompilerwhen an override is provided. Also fixedsetupActionModeso that explicitly specifying--action-mode actionalongside--action-tagrespects the action mode instead of always forcing release mode.cmd/gh-aw/main.go: Registered the--actions-repoflag, reads its value, and passes it toCompileConfig.pkg/cli/workflows/test-actions-repo.md: Added a canonical fixture workflow used by the new integration tests.pkg/cli/compile_integration_test.go: Added two integration tests (TestCompileWithActionsRepoFlagandTestCompileWithActionsRepoDefaultFallback) that compile the fixture workflow and verify the custom repository — or the defaultgithub/gh-aw-actions— is correctly baked into the generated lock file.Usage
Security Summary
No security vulnerabilities were introduced. The flag accepts a repository slug string that is used as-is to construct action references in the compiled YAML. No code execution or privilege escalation is possible from this value.
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.