Conversation
…no-emit with all linters Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
gh aw verify command
|
@copilot, rename the command to |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in e8bbe5b. The command is now |
gh aw verify commandgh aw validate command
There was a problem hiding this comment.
Pull request overview
Adds a new gh aw validate CLI command intended to provide an ergonomic shortcut for validating workflows (compile + validation + linters) without emitting lock files.
Changes:
- Introduces
pkg/cli/NewValidateCommand()that delegates toCompileWorkflowswith validation-oriented defaults. - Registers the new
validatecommand under thedevelopmentcommand group in the CLI entrypoint. - Documents
gh aw validatein the compilation process reference.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/validate_command.go | New validate command wiring and compile configuration defaults |
| pkg/cli/validate_command_test.go | Unit test asserting command/flag shape |
| cmd/gh-aw/main.go | Registers validate command and assigns it to the development group |
| docs/src/content/docs/reference/compilation-process.md | Adds gh aw validate rows to the command reference table |
| pkg/cli/verify_command.go | Adds an empty “superseded” stub file for verify |
| pkg/cli/verify_command_test.go | Adds an empty “superseded” stub test file for verify |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| | `gh aw validate` | Validate all workflows (compile + all linters, no file output) | | ||
| | `gh aw validate my-workflow` | Validate a specific workflow | | ||
| | `gh aw validate --json` | Validate and output results in JSON format | | ||
| | `gh aw validate --strict` | Validate with strict mode enforced | |
There was a problem hiding this comment.
Docs say gh aw validate runs “compile + all linters” with no file output, but the current implementation forces NoEmit: true, and the compile pipeline only runs zizmor/actionlint/poutine when !NoEmit. Either adjust the implementation so linters run in validate mode, or update this documentation to match actual behavior.
| | `gh aw validate` | Validate all workflows (compile + all linters, no file output) | | |
| | `gh aw validate my-workflow` | Validate a specific workflow | | |
| | `gh aw validate --json` | Validate and output results in JSON format | | |
| | `gh aw validate --strict` | Validate with strict mode enforced | | |
| | `gh aw validate` | Validate all workflows (configuration only; no file output or security linters) | | |
| | `gh aw validate my-workflow` | Validate configuration for a specific workflow (no file output or security linters) | | |
| | `gh aw validate --json` | Validate configuration and output results in JSON format (no security linters) | | |
| | `gh aw validate --strict` | Validate with strict mode enforced (configuration only; run linters via \`gh aw compile\` for security scanning) | |
| config := CompileConfig{ | ||
| MarkdownFiles: args, | ||
| Verbose: verbose, | ||
| EngineOverride: engineOverride, | ||
| Validate: true, | ||
| NoEmit: true, | ||
| Zizmor: true, | ||
| Actionlint: true, | ||
| Poutine: true, | ||
| WorkflowDir: dir, |
There was a problem hiding this comment.
NoEmit: true will prevent actionlint/zizmor/poutine from running at all. The compile pipeline only runs these tools when !config.NoEmit (e.g., pkg/cli/compile_orchestration.go:132-158 and similar), because it collects generated .lock.yml paths. As written, gh aw validate will effectively skip the external linters despite setting Zizmor/Actionlint/Poutine to true. Consider either (a) emitting lock files to a temp location and cleaning them up after linting, (b) allowing linters to run against in-memory output/temporary files even in no-emit mode, or (c) not forcing NoEmit when linters are requested.
| if _, err := CompileWorkflows(context.Background(), config); err != nil { | ||
| return err |
There was a problem hiding this comment.
CompileWorkflows is called with context.Background(), so cancellation/timeouts from Cobra (Ctrl-C, parent context) won’t propagate. This is inconsistent with the compile command which passes cmd.Context() (see cmd/gh-aw/main.go:322). Use cmd.Context() here instead.
| @@ -0,0 +1,2 @@ | |||
| // Package cli - verify_command.go is superseded by validate_command.go. | |||
There was a problem hiding this comment.
This new // Package cli ... comment is a package doc comment and may override/compete with the real package documentation in pkg/cli/doc.go when generating docs. Since the file is otherwise empty, consider deleting it, or at least move the comment below package cli (or change it to a non-package comment) to avoid impacting package docs.
| // Package cli - verify_command.go is superseded by validate_command.go. | |
| // verify_command.go is superseded by validate_command.go. |
…cedence - Add `validate` command section to setup/cli.md (Building section, after compile). The command was added in #18191 but was missing from the main CLI reference page; only the compilation-process.md reference table had been updated. - Add NOTE callout to reference/threat-detection.md clarifying that an explicit `threat-detection: false` in a workflow takes precedence over imported fragments, documenting the behaviour fixed in #18231. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Running
gh aw compile --validate --no-emit --zizmor --actionlint --poutineto validate a workflow without generating lock files is verbose and hard to discover.gh aw validateprovides a single ergonomic entry point for full workflow validation.Changes
pkg/cli/validate_command.go: NewNewValidateCommand()that delegates toCompileWorkflowswithValidate,NoEmit,Zizmor,Actionlint, andPoutineall set totrue, and exposes all relevant compile flagscmd/gh-aw/main.go: Registersvalidatein thedevelopmentcommand groupdocs/: Addsgh aw validateto the compilation commands reference tableUsage
Equivalent to:
All existing
compileflags are supported, including--engine/-e,--dir/-d,--strict,--json/-j,--fail-fast,--stats, and--no-check-update. The linters (zizmor, actionlint, poutine),--validate, and--no-emitare always-on defaults.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.